Neural Network-Based In-Loop Filter With Residual Scaling For Video Coding

ABSTRACT

A method implemented by a video coding apparatus. The method includes applying an output of a neural network (NN) filter to an unfiltered sample of a video unit to generate a residual, applying a scaling function to the residual to generate a scaled residual, adding another unfiltered sample to the scaled residual to generate a filtered sample, and converting between a video media file and a bitstream based on the filtered sample that was generated. A corresponding video coding apparatus and non-transitory computer readable medium are also disclosed.

CROSS-REFERENCE TO RELATED APPLICATIONS

This patent application claims the benefit of U.S. Provisional PatentApplication No. 63/156,726 filed Mar. 4, 2021, by Lemon, Inc., andtitled “Neural Network-Based In-Loop Filter With Residual Scaling ForVideo Coding,” which is hereby incorporated by reference.

TECHNICAL FIELD

The present disclosure is generally related to video coding and, inparticular, to the in-loop filter in image/video coding.

BACKGROUND

Digital video accounts for the largest bandwidth use on the internet andother digital communication networks. As the number of connected userdevices capable of receiving and displaying video increases, it isexpected that the bandwidth demand for digital video usage will continueto grow.

SUMMARY

The disclosed aspects/embodiments provide one or more neural network(NN) filter models trained as part of an in-loop filtering technology orfiltering technology used in a post-processing stage for reducing thedistortion incurred during compression. In addition, samples withdifferent characteristics are processed by different NN filter models.The present disclosure also elaborates how to scale the output of NNfilters to achieve better performance, how to set an interference blocksize, and how to combine the output of multiple NN filter models.

A first aspect relates to a method implemented by a coding apparatus.The method includes applying an output of a neural network (NN) filterto an unfiltered sample of a video unit to generate a residual; applyinga scaling function to the residual to generate a scaled residual; addinganother unfiltered sample to the scaled residual to generate a filteredsample; and converting between a video media file and a bitstream basedon the filtered sample that was generated.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides reconstructing the unfiltered sample prior togenerating the residual.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides that the filtered sample is generated according toY=X+F(R), where X represents the unfiltered sample, R represents theresidual determined based on the output of the NN filter, F representsthe scaling function, and Y represents the filtered sample.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides that the filtered sample is generated according toY=X+F(R, X), where X represents the unfiltered sample, R represents theresidual determined based on the output of the NN filter, F representsthe scaling function, and Y represents the filtered sample.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides that the filtered sample is generated according toY=X+F(R−X), where X represents the unfiltered sample, R represents theresidual determined based on the output of the NN filter, F representsthe scaling function, and Y represents the filtered sample.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides that the filtered sample is generated according toY=Clip(X+F(R)), where X represents the unfiltered sample, R representsthe residual determined based on the output of the NN filter, Frepresents the scaling function, Clip represents a clipping functionbased on a bit depth of the unfiltered sample, and Y represents thefiltered sample.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides the scaling function is based on a linear modelaccording to F(R)=α×R+β, where R represents the residual determinedbased on the output of the NN filter, F represents the scaling function,and a and 13 represent a pair of coefficient candidates (α, β).

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides determining an inference block size to be used whenthe NN filter is applied to the unfiltered sample.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides selecting the inference block size from a pluralityof inference block size candidates, wherein each of the plurality ofinference block size candidates is based on at least one of aquantization parameter, a slice type, a picture type, a partition tree,and a color component.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides parsing the bitstream to obtain an indicator,wherein the indicator indicates which inference block size is to be usedwhen the NN filter is applied to the unfiltered sample.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides that the inference block size has a first value fora first bit rate and a second value for a second bit rate, wherein thefirst value is higher than the second value, and wherein the first bitrate is lower than the second bit rate.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides that the inference block size has a first value fora first resolution and a second value for a second resolution, whereinthe first value is higher than the second value, and wherein the firstresolution is higher than the second bit resolution.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides that the NN filter is one of a plurality of NNfilters whose outputs are applied to the unfiltered sample to generatethe residual.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides that some of the plurality of NN filters usedifferent inference block sizes when the outputs are applied to theunfiltered sample.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides that the outputs of the plurality of NN filters areindividually weighted and applied to the unfiltered sample as a weightedsum.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides that a model and a weight corresponding to each ofthe plurality of NN filters is signaled in the bitstream.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides that a weight corresponding to each of the pluralityof NN filters is based on one or more of a quantization parameter, aslice type, a picture type, a color component, a color format, and atemporal layer.

Optionally, in any of the preceding aspects, another implementation ofthe aspect provides that a weight corresponding to each of the pluralityof NN filters is based on one or more of an NN filter model, aninference block size, or a spatial location of the unfiltered sample.

A second aspect relates to an apparatus for coding video data comprisinga processor and a non-transitory memory with instructions thereon,wherein the instructions upon execution by the processor cause theprocessor to: apply an output of a neural network (NN) filter to anunfiltered sample of a video unit to generate a residual; apply ascaling function to the residual to generate a scaled residual; addanother unfiltered sample to the scaled residual to generate a filteredsample; and convert between a video media file and a bitstream based onthe filtered sample that was generated.

A third aspect relates to a non-transitory computer readable mediumcomprising a computer program product for use by a coding apparatus, thecomputer program product comprising computer executable instructionsstored on the non-transitory computer readable medium that, whenexecuted by one or more processors, cause the coding apparatus to: applyan output of a neural network (NN) filter to an unfiltered sample of avideo unit to generate a residual; apply a scaling function to theresidual to generate a scaled residual; add another unfiltered sample tothe scaled residual to generate a filtered sample; and convert between avideo media file and a bitstream based on the filtered sample that wasgenerated.

For the purpose of clarity, any one of the foregoing embodiments may becombined with any one or more of the other foregoing embodiments tocreate a new embodiment within the scope of the present disclosure.

These and other features will be more clearly understood from thefollowing detailed description taken in conjunction with theaccompanying drawings and claims.

BRIEF DESCRIPTION OF THE DRAWINGS

For a more complete understanding of this disclosure, reference is nowmade to the following brief description, taken in connection with theaccompanying drawings and detailed description, wherein like referencenumerals represent like parts.

FIG. 1 is an example of raster-scan slice partitioning of a picture.

FIG. 2 is an example of rectangular slice partitioning of a picture.

FIG. 3 is an example of a picture partitioned into tiles, bricks, andrectangular slices.

FIG. 4A is an example of coding tree blocks (CTBs) crossing the bottompicture border.

FIG. 4B is an example of CTBs crossing the right picture border.

FIG. 4C is an example of CTBs crossing the right bottom picture border.

FIG. 5 is an example of encoder block diagram.

FIG. 6 is an illustration of samples within 8×8 blocks of samples.

FIG. 7 is an example of pixels involved in filter on/off decision andstrong/weak filter selection.

FIG. 8 shows four one dimensional (1-D) directional patterns for EOsample classification.

FIG. 9 shows examples of geometry transformation-based adaptive loopfilter (GALF) filter shapes.

FIG. 10 shows an example of relative coordinates used for the 5×5diamond filter support.

FIG. 11 shows another example of relative coordinates used for the 5×5diamond filter support.

FIG. 12A is an example architecture of the proposed CNN filter.

FIG. 12B is an example of construction of residual block (ResBlock).

FIG. 13A is an example of a process for generating filtered samplesusing residual scaling and neural network filtering.

FIG. 13B is another example of a process for generating filtered samplesusing residual scaling and neural network filtering.

FIG. 13C is another example of a process for generating filtered samplesusing residual scaling and neural network filtering.

FIG. 13D is another example of a process for generating filtered samplesusing residual scaling and neural network filtering.

FIG. 14 is a block diagram showing an example video processing system.

FIG. 15 is a block diagram of a video processing apparatus.

FIG. 16 is a block diagram that illustrates an example video codingsystem.

FIG. 17 is a block diagram illustrating an example of video encoder.

FIG. 18 is a block diagram illustrating an example of video decoder.

FIG. 19 is a method for coding video data according to an embodiment ofthe disclosure.

DETAILED DESCRIPTION

It should be understood at the outset that although an illustrativeimplementation of one or more embodiments are provided below, thedisclosed systems and/or methods may be implemented using any number oftechniques, whether currently known or in existence. The disclosureshould in no way be limited to the illustrative implementations,drawings, and techniques illustrated below, including the exemplarydesigns and implementations illustrated and described herein, but may bemodified within the scope of the appended claims along with their fullscope of equivalents.

H.266 terminology is used in some description only for ease ofunderstanding and not for limiting scope of the disclosed techniques. Assuch, the techniques described herein are applicable to other videocodec protocols and designs also.

Video coding standards have evolved primarily through the development ofthe well-known International Telecommunication Union-Telecommunication(ITU-T) and International Organization for Standardization(ISO)/International Electrotechnical Commission (IEC) standards. TheITU-T produced H.261 and H.263, ISO/IEC produced Moving Picture ExpertsGroup (MPEG)-1 and MPEG-4 Visual, and the two organizations jointlyproduced the H.262/MPEG-2 Video and H.264/MPEG-4 Advanced Video Coding(AVC) and H.265/High Efficiency Video Coding (HEVC) standards.

Since H.262, the video coding standards are based on the hybrid videocoding structure wherein temporal prediction plus transform coding areutilized. To explore the future video coding technologies beyond HEVC,Joint Video Exploration Team (JVET) was founded by Video Coding ExpertsGroup (VCEG) and MPEG jointly in 2015. Since then, many new methods havebeen adopted by JVET and put into the reference software named JointExploration Model (JEM).

In April 2018, the Joint Video Expert Team (JVET) between VCEG (Q6/16)and ISO/IEC JTC1 SC29/WG11 (MPEG) was created to work on the VersatileVideo Coding (VVC) standard targeting at fifty percent (50%) bitratereduction compared to HEVC. VVC version 1 was finalized in July 2020.

Color space and chroma subsampling are discussed. Color space, alsoknown as the color model (or color system), is an abstract mathematicalmodel which simply describes the range of colors as tuples of numbers,typically as 3 or 4 values or color components (e.g., red green blue(RGB)). Basically speaking, color space is an elaboration of thecoordinate system and sub-space.

For video compression, the most frequently used color spaces are YCbCrand RGB. Y′CbCr, or Y Pb/Cb Pr/Cr, also written as YCBCR or Y′CBCR, is afamily of color spaces used as a part of the color image pipeline invideo and digital photography systems. Y′ is the luma component and CBand CR are the blue-difference and red-difference chroma components. Y′(with prime) is distinguished from Y, which is luminance, meaning thatlight intensity is nonlinearly encoded based on gamma corrected RGBprimaries.

Chroma subsampling is the practice of encoding images by implementingless resolution for chroma information than for luma information, takingadvantage of the human visual system's lower acuity for colordifferences than for luminance.

For 4:4:4: chroma subsampling, each of the three Y′CbCr components havethe same sample rate, thus there is no chroma subsampling. This schemeis sometimes used in high-end film scanners and cinematic postproduction.

For 4:2:2 chroma subsampling, the two chroma components are sampled athalf the sample rate of luma: the horizontal chroma resolution ishalved. This reduces the bandwidth of an uncompressed video signal byone-third with little to no visual difference.

For 4:2:0 chroma subsampling, the horizontal sampling is doubledcompared to 4:1:1, but as the Cb and Cr channels are only sampled oneach alternate line in this scheme, the vertical resolution is halved.The data rate is thus the same. Cb and Cr are each subsampled at afactor of two both horizontally and vertically. There are three variantsof 4:2:0 schemes, having different horizontal and vertical siting.

In MPEG-2, Cb and Cr are co-sited horizontally. Cb and Cr are sitedbetween pixels in the vertical direction (sited interstitially). InJoint Photographic Experts Group (JPEG)/JPEG File Interchange Format(JFIF), H.261, and MPEG-1, Cb and Cr are sited interstitially, halfwaybetween alternate luma samples. In 4:2:0 DV, Cb and Cr are co-sited inthe horizontal direction. In the vertical direction, they are co-sitedon alternating lines.

Definitions of video units are provided. A picture is divided into oneor more tile rows and one or more tile columns. A tile is a sequence ofcoding tree units (CTUs) that covers a rectangular region of a picture.A tile is divided into one or more bricks, each of which consists of anumber of CTU rows within the tile. A tile that is not partitioned intomultiple bricks is also referred to as a brick. However, a brick that isa true subset of a tile is not referred to as a tile. A slice eithercontains a number of tiles of a picture or a number of bricks of a tile.

Two modes of slices are supported, namely the raster-scan slice mode andthe rectangular slice mode. In the raster-scan slice mode, a slicecontains a sequence of tiles in a tile raster scan of a picture. In therectangular slice mode, a slice contains a number of bricks of a picturethat collectively form a rectangular region of the picture. The brickswithin a rectangular slice are in the order of brick raster scan of theslice.

FIG. 1 is an example of raster-scan slice partitioning of a picture 100,where the picture is divided into twelve tiles 102 and three raster-scanslices 104. As shown, each of the tiles 102 and slices 104 contains anumber of CTUs 106.

FIG. 2 is an example of rectangular slice partitioning of a picture 200according to the VVC specification, where the picture is divided intotwenty-four tiles 202 (six tile columns 203 and four tile rows 205) andnine rectangular slices 204. As shown, each of the tiles 202 and slices204 contains a number of CTUs 206.

FIG. 3 is an example of a picture 300 partitioned into tiles, bricks,and rectangular slices according to the VVC specification, where thepicture is divided into four tiles 302 (two tile columns 303 and twotile rows 305), eleven bricks 304 (the top-left tile contains one brick,the top-right tile contains five bricks, the bottom-left tile containstwo bricks, and the bottom-right tile contain three bricks), and fourrectangular slices 306.

CTU and coding tree block (CTB) sizes are discussed. In VVC, the codingtree unit (CTU) size, which is signaled in a sequence parameter set(SPS) by the syntax element log 2_ctu_size_minus2, could be as small as4×4. The sequence parameter set raw byte sequence payload (RBSP) syntaxis below.

Descriptor seq_parameter_set_rbsp( ) {  sps_decoding_parameter_set_idu(4)  sps_video_parameter_set_id u(4)  sps_max_sub_layers_minus1 u(3) sps_reserved_zero_5bits u(5)  profile_tier_level(sps_max_sub_layers_minus1 )  gra_enabled_flag u(1) sps_seq_parameter_set_id ue(v)  chroma_format_idc ue(v)  if(chroma_format_idc = = 3 )   separate_colour_plane_flag u(1) pic_width_in_luma_samples ue(v)  pic_height_in_luma_samples ue(v) conformance_window_flag u(1)  if( conformance_window_flag ) {  conf_win_left_offset ue(v)   conf_win_right_offset ue(v)  conf_win_top_offset ue(v)   conf_win_bottom_offset ue(v)  } bit_depth_luma_minus8 ue(v)  bit_depth_chroma_minus8 ue(v) log2_max_pic_order_cnt_lsb_minus4 ue(v) sps_sub_layer_ordering_info_present_flag u(1)  for( i = (sps_sub_layer_ordering_info_present_flag ? 0 : sps_max_sub_layers_minus1);    i <= sps_max_sub_layers_minus1; i++ ) {  sps_max_dec_pic_buffering_minus1[ i ] ue(v)  sps_max_num_reorder_pics[ i ] ue(v)   sps_max_latency_increase_plus1[i ] ue(v)  }  long_term_ref_pics_flag u(1)  sps_idr_rpl_present_flagu(1)  rpl1_same_as_rpl0_flag u(1)  for( i = 0; i<!rpl1_same_as_rpl0_flag ? 2 : 1; i++ ) {   num_ref_pic_lists_in_sps[ i] ue(v)   for( j = 0; j < num_ref_pic_lists_in_sps[ i ]; j++)   ref_pic_list_struct( i, j )  }  qtbtt_dual_tree_intra_flag u(1) log2_ctu_size_minus2 ue(v)  log2_min_luma_coding_block_size_minus2ue(v)  partition_constraints_override_enabled_flag u(1) sps_log2_diff_min_qt_min_cb_intra_slice_luma ue(v) sps_log2_diff_min_qt_min_cb_inter_slice ue(v) sps_max_mtt_hierarchy_depth_inter_slice ue(v) sps_max_mtt_hierarchy_depth_intra_slice_luma ue(v)  if(sps_max_mtt_hierarchy_depth_intra_slice_luma != 0 ) {  sps_log2_diff_max_bt_min_qt_intra_slice_luma ue(v)  sps_log2_diff_max_tt_min_qt_intra_slice_luma ue(v)  }  if(sps_max_mtt_hierarchy_depth_inter_slices != 0 ) {  sps_log2_diff_max_bt_min_qt_inter_slice ue(v)  sps_log2_diff_max_tt_min_qt_inter_slice ue(v)  }  if(qtbtt_dual_tree_intra_flag ) {  sps_log2_diff_min_qt_min_cb_intra_slice_chroma ue(v)  sps_max_mtt_hierarchy_depth_intra_slice_chroma ue(v)   if (sps_max_mtt_hierarchy_depth_intra_slice_chroma != 0 ) {   sps_log2_diff_max_bt_min_qt_intra_slice_chroma ue(v)   sps_log2_diff_max_tt_min_qt_intra_slice_chroma ue(v)   }  } ... rbsp_trailing_bits( ) }

log 2_ctu_size_minus2 plus 2 specifies the luma coding tree block sizeof each CTU.

log 2_min_luma_coding_block_size_minus2 plus 2 specifies the minimumluma coding block size.

The variables CtbLog2SizeY, CtbSizeY, MinCbLog2SizeY, MinCbSizeY,MinTbLog2SizeY, MaxTbLog2SizeY, MinTbSizeY, MaxTbSizeY, PicWidthInCtbsY,PicHeightInCtbsY, PicSizeInCtbsY, PicWidthInMinCbsY, PicHeightInMinCbsY,PicSizeInMinCbsY, PicSizeInSamplesY, PicWidthInSamplesC andPicHeightInSamplesC are derived as follows.

CtbLog2SizeY=log 2_ctu_size_minus2+2  (7-9)

CtbSizeY=1<<CtbLog2SizeY  (7-10)

MinCbLog2SizeY=log 2_min_luma_coding_block_size_minus2+2  (7-11)

MinCbSizeY=1<<MinCbLog2SizeY  (7-12)

MinTbLog2SizeY=2  (7-13)

MaxTbLog2SizeY=6  (7-14)

MinTbSizeY=1<<MinTbLog2SizeY  (7-15)

MaxTbSizeY=1<<MaxTbLog2SizeY  (7-16)

PicWidthInCtbsY=Ceil(pic_width_in_luma_samples÷CtbSizeY)  (7-17)

PicHeightInCtbsY=Ceil(pic_height_in_luma_samples÷CtbSizeY)  (7-18)

PicSizeInCtbsY=PicWidthInCtbsY*PicHeightInCtbsY  (7-19)

PicWidthInMinCbsY=pic_width_in_luma_samples/MinCbSizeY  (7-20)

PicHeightInMinCbsY=pic_height_in_luma_samples/MinCbSizeY  (7-21)

PicSizelnMinCbsY=PicWidthInMinCbsY*PicHeightInMinCbsY  (7-22)

PicSizeInSamplesY=pic_widthin_luma_samples*pic_height_in_luma_samples  (7-23)

PicWidthInSamplesC=pic_width_in_luma_samples/SubWidthC  (7-24)

PicHeightInSamplesC=pic_height_in_luma_samples/SubHeightC  (7-25)

FIG. 4A is an example of CTBs crossing the bottom picture border. FIG.4B is an example of CTBs crossing the right picture border. FIG. 4C isan example of CTBs crossing the right bottom picture border. In FIGS.4A-4C, K=M, L<N; K<M, L=N; K<M, L<N, respectively.

CTUs in a picture 400 are discussed with reference to FIGS. 4A-4C.Suppose the CTB/largest coding unit (LCU) size indicated by M×N(typically M is equal to N, as defined in HEVC/VVC), and for a CTBlocated at picture (or tile or slice or other kinds of types, pictureborder is taken as an example) border, K×L samples are within pictureborder wherein either K<M or L<N. For those CTBs 402 as depicted in FIG.4A-4C, the CTB size is still equal to M×N, however, the bottomboundary/right boundary of the CTB is outside the picture 400.

The coding flow of a typical video coder/decoder (a.k.a., codec) isdiscussed. FIG. 5 is an example of encoder block diagram of VVC, whichcontains three in-loop filtering blocks: deblocking filter (DF), sampleadaptive offset (SAO) and adaptive loop filter (ALF). Unlike DF, whichuses predefined filters, SAO and ALF utilize the original samples of thecurrent picture to reduce the mean square errors between the originalsamples and the reconstructed samples by adding an offset and byapplying a finite impulse response (FIR) filter, respectively, withcoded side information signaling the offsets and filter coefficients.ALF is located at the last processing stage of each picture and can beregarded as a tool trying to catch and fix artifacts created by theprevious stages.

FIG. 5 is a schematic diagram of an encoder 500. The encoder 500 issuitable for implementing the techniques of VVC. The encoder 500includes three in-loop filters, namely a deblocking filter (DF) 502, asample adaptive offset (SAO) 504, and an ALF 506. Unlike the DF 502,which uses predefined filters, the SAO 504 and the ALF 506 utilize theoriginal samples of the current picture to reduce the mean square errorsbetween the original samples and the reconstructed samples by adding anoffset and by applying a FIR filter, respectively, with coded sideinformation signaling the offsets and filter coefficients. The ALF 506is located at the last processing stage of each picture and can beregarded as a tool trying to catch and fix artifacts created by theprevious stages.

The encoder 500 further includes an intra prediction component 508 and amotion estimation/compensation (ME/MC) component 510 configured toreceive input video. The intra prediction component 508 is configured toperform intra prediction, while the ME/MC component 510 is configured toutilize reference pictures obtained from a reference picture buffer 512to perform inter prediction. Residual blocks from inter prediction orintra prediction are fed into a transform component 514 and aquantization component 516 to generate quantized residual transformcoefficients, which are fed into an entropy coding component 518. Theentropy coding component 518 entropy codes the prediction results andthe quantized transform coefficients and transmits the same toward avideo decoder (not shown). Quantization components output from thequantization component 516 may be fed into an inverse quantizationcomponent 520, an inverse transform component 522, and a reconstruction(REC) component 524. The REC component 524 is able to output images tothe DF 502, the SAO 504, and the ALF 506 for filtering prior to thoseimages being stored in the reference picture buffer 512.

The input of the DF 502 is the reconstructed samples before in-loopfilters. The vertical edges in a picture are filtered first. Then thehorizontal edges in a picture are filtered with samples modified by thevertical edge filtering process as input. The vertical and horizontaledges in the CTBs of each CTU are processed separately on a coding unitbasis. The vertical edges of the coding blocks in a coding unit arefiltered starting with the edge on the left-hand side of the codingblocks proceeding through the edges towards the right-hand side of thecoding blocks in their geometrical order. The horizontal edges of thecoding blocks in a coding unit are filtered starting with the edge onthe top of the coding blocks proceeding through the edges towards thebottom of the coding blocks in their geometrical order.

FIG. 6 is an illustration 600 of samples 602 within 8×8 blocks ofsamples 604. As shown, the illustration 600 includes horizontal andvertical block boundaries on an 8×8 grid 606, 608, respectively. Inaddition, the illustration 600 depicts the nonoverlapping blocks of the8×8 samples 610, which can be deblocked in parallel.

The boundary decision is discussed. Filtering is applied to 8×8 blockboundaries. In addition, it must be a transform block boundary or acoding subblock boundary (e.g., due to usage of Affine motionprediction, Alternative temporal motion vector prediction (ATMVP)). Forthose which are not such boundaries, the filter is disabled.

The boundary strength calculation is discussed. For a transform blockboundary/coding subblock boundary, if it is located in the 8×8 grid, thetransform block boundary/coding subblock boundary may be filtered andthe setting of bS[xD_(i),] [yD_(j)] (wherein [xD_(i)][yD_(j)] denotesthe coordinate) for this edge is defined in Table 1 and Table 2,respectively.

TABLE 1 Boundary strength (when SPS IBC is disabled) Priority ConditionsY U V 5 At least one of the adjacent blocks is intra 2 2 2 4 TU boundaryand at least one of the adjacent 1 1 1 blocks has non-zero transformcoefficients 3 Reference pictures or number of MVs (1 for 1 N/A N/Auni-prediction, 2 for bi-prediction) of the adjacent blocks aredifferent 2 Absolute difference between the motion 1 N/A N/A vectors ofsame reference picture that belong to the adjacent blocks is greaterthan or equal to one integer luma sample 1 Otherwise 0 0 0

TABLE 2 Boundary strength (when SPS IBC is enabled) Priority ConditionsY U V 8 At least one of the adjacent blocks is intra 2 2 2 7 TU boundaryand at least one of the adjacent 1 1 1 blocks has non-zero transformcoefficients 6 Prediction mode of adjacent blocks is 1 different (e.g.,one is IBC, one is inter) 5 Both IBC and absolute difference between 1N/A N/A the motion vectors that belong to the adjacent blocks is greaterthan or equal to one integer luma sample 4 Reference pictures or numberof MVs (1 for 1 N/A N/A uni-prediction, 2 for bi-prediction) of theadjacent blocks are different 3 Absolute difference between the motion 1N/A N/A vectors of same reference picture that belong to the adjacentblocks is greater than or equal to one integer luma sample 1 Otherwise 00 0

The deblocking decision for a luma component is discussed.

FIG. 7 is an example 700 of pixels involved in filter on/off decisionand strong/weak filter selection. A wider-stronger luma filter is usedonly if all of the Condition 1, Condition 2, and Condition 3 are TRUE.The Condition 1 is the “large block condition” This condition detectswhether the samples at P-side and Q-side belong to large blocks, whichare represented by the variable bSidePisLargeBlk and bSideQisLargeBlk,respectively. The bSidePisLargeBlk and bSideQisLargeBlk are defined asfollows.

bSidePisLargeBlk = ((edge type is vertical and p₀ belongs to CU withwidth >= 32) || (edge type is horizontal and p₀ belongs to CU withheight >= 32))? TRUE: FALSE bSideQisLargeBlk = ((edge type is verticaland q₀ belongs to CU with width >= 32) || (edge type is horizontal andq₀ belongs to CU with height >= 32))? TRUE: FALSE

Based on bSidePisLargeBlk and bSideQisLargeBlk, the Condition 1 isdefined as follows.

Condition1=(bSidePisLargeBlk∥bSidePisLargeBlk)?TRUE:FALSE

Next, if Condition 1 is true, the Condition 2 will be further checked.First, the following variables are derived.

 dp0, dp3, dq0, dq3 are first derived as in HEVC  if (p side is greaterthan or equal to 32)   dp0 = ( dp0 + Abs( p5₀ − 2 * p4₀ + p3₀ ) + 1 ) >>1   dp3 = ( dp3 + Abs( p5₃ − 2 * p4₃ + p3₃ ) + 1 ) >> 1  if (q side isgreater than or equal to 32)   dq0 = ( dq0 + Abs( q5₀ − 2 * q4₀ + q3₀) + 1 ) >> 1   dq3 = ( dq3 + Abs( q5₃ − 2 * q4₃ + q3₃) + 1 ) >> 1Condition 2 = (d < β) ? TRUE: FALSE   where d= dp0 + dq0 + dp3 + dq3.

If Condition 1 and Condition 2 are valid, whether any of the blocks usessub-blocks is further checked.

If (bSidePisLargeBlk) { If (mode block P == SUBBLOCKMODE)   Sp =5  else Sp =7 } else  Sp = 3 If (bSideQisLargeBlk)   { If (mode block Q ==SUBBLOCKMODE)    Sq =5   else Sq =7 } else Sq = 3

Finally, if both the Condition 1 and Condition 2 are valid, the proposeddeblocking method will check the condition 3 (the large block strongfilter condition), which is defined as follows.

   In the Condition3 StrongFilterCondition, the following variables arederived. dpq is derived as in HEVC. sp₃ = Abs( p₃ − p₀ ), derived as inHEVC if (p side is greater than or equal to 32)   if(Sp==5)    sp₃ = (sp₃ + Abs( p₅ − p₃ ) + 1) >> 1   else    sp₃ = ( sp₃ + Abs( p₇ − p₃) + 1) >> 1 sq₃ = Abs( q₀ − q₃ ), derived as in HEVC if (q side isgreater than or equal to 32)  If(Sq==5)   sq₃ = ( sq₃ + Abs( q₅ − q₃) + 1) >> 1  else   sq₃ = ( sq₃ + Abs( q₇ − q₃ ) + 1) >> 1

As in HEVC, StrongFilterCondition=(dpq is less than (β>>2), sp₃+sq₃ isless than (3*β>>5), and Abs(p₀−q₀) is less than (5*t_(C)+1)>>1)?TRUE:FALSE.

A stronger deblocking filter for luma (designed for larger blocks) isdiscussed.

Bilinear filter is used when samples at either one side of a boundarybelong to a large block. A sample belonging to a large block is definedas when the width>=32 for a vertical edge, and when height>=32 for ahorizontal edge.

The bilinear filter is listed below.

Block boundary samples p_(i) for i=0 to Sp−1 and q_(i) for j=0 to Sq−1(pi and qi are the i-th sample within a row for filtering vertical edge,or the i-th sample within a column for filtering horizontal edge) inHEVC deblocking described above) are then replaced by linearinterpolation as follows.

p _(i)′=(f _(i)*Middle_(s,t)+(64−f _(i))*P _(s)+32)>>6),clipped to p_(i)±tcPD_(i)

q _(j)′=(g _(j)*Middle_(s,t)+(64−g _(j))*Q _(s)+32)>>6),clipped to q_(j)±tcPD_(j)

where tcPD_(i) and tcPD_(i) term is a position dependent clippingdescribed in below and g_(i), f_(i), Middle_(s,t), P_(s) and Q_(s) aregiven below.

A deblocking control for chroma is discussed.

The chroma strong filters are used on both sides of the block boundary.Here, the chroma filter is selected when both sides of the chroma edgeare greater than or equal to 8 (chroma position), and the followingdecision with three conditions are satisfied: the first one is fordecision of boundary strength as well as large block. The proposedfilter can be applied when the block width or height which orthogonallycrosses the block edge is equal to or larger than 8 in chroma sampledomain. The second and third one is basically the same as for HEVC lumadeblocking decision, which are on/off decision and strong filterdecision, respectively.

In the first decision, boundary strength (bS) is modified for chromafiltering and the conditions are checked sequentially. If a condition issatisfied, then the remaining conditions with lower priorities areskipped.

Chroma deblocking is performed when bS is equal to 2, or bS is equal to1 when a large block boundary is detected.

The second and third condition is basically the same as HEVC luma strongfilter decision as follows.

In the second condition: d is then derived as in HEVC luma deblocking.The second condition will be TRUE when d is less than β.

In the third condition StrongFilterCondition is derived as follows.

sp ₃=Abs(p ₃ −p ₀), derived as in HEVC

sq ₃=Abs(q ₀ −q ₃), derived as in HEVC

As in HEVC design, StrongFilterCondition=(dpq is less than (β>>2),sp₃+sq₃ is less than (β>>3), and Abs(p₀−q₀) is less than(5*t_(C)+1)>>1).

A strong deblocking filter for chroma is discussed. The following strongdeblocking filter for chroma is defined.

p ₂′=(3*p ₃+2*p ₂ +p ₁ +p ₀ +q ₀+4)>>3

p ₁′=(2*p ₃ +p ₂+2*p ₁ +p ₀ +q ₀ +q ₁+4)>>3

p ₀′=(p ₃ +p ₂ +p ₁+2*p ₀ +q ₀ +q ₁ +q ₂+4)>>3

The proposed chroma filter performs deblocking on a 4×4 chroma samplegrid.

Position dependent clipping (tcPD) is discussed. The position dependentclipping tcPD is applied to the output samples of the luma filteringprocess involving strong and long filters that are modifying 7, 5, and 3samples at the boundary. Assuming quantization error distribution, it isproposed to increase clipping value for samples which are expected tohave higher quantization noise, thus expected to have higher deviationof the reconstructed sample value from the true sample value.

For each P or Q boundary filtered with asymmetrical filter, depending onthe result of decision-making process in the boundary strengthcalculation, position dependent threshold table is selected from twotables (i.e., Tc7 and Tc3 tabulated below) that are provided to decoderas a side information.

Tc7={6,5,4,3,2,1,1};Tc3={6,4,2};

tcPD=(Sp==3)?Tc3:Tc7;

tcQD=(Sq==3)?Tc3:Tc7;

For the P or Q boundaries being filtered with a short symmetricalfilter, position dependent threshold of lower magnitude is applied.

Tc3={3,2,1};

Following defining the threshold, filtered p′_(i) and q′_(i) samplevalues are clipped according to tcP and tcQ clipping values.

p″ _(i)=Clip3(p′ _(i) +tcP _(i) ,p′ _(i) −tcP _(i) ,p′ _(i));

q″ _(j)=Clip3(q′ _(j) +tcQ _(j) ,q′ _(j) −tcQ _(j) ,q′ _(j));

where p′_(i) and q′_(i) are filtered sample values, p″_(i) and q″_(j)are output sample value after the clipping and tcP_(i) tcP_(i) areclipping thresholds that are derived from the VVC tc parameter and tcPDand tcQD. The function Clip3 is a clipping function as it is specifiedin VVC.Sub-block deblocking adjustment is discussed.

To enable parallel friendly deblocking using both long filters andsub-block deblocking the long filters is restricted to modify at most 5samples on a side that uses sub-block deblocking (AFFINE or ATMVP ordecoder side motion vector refinement (DMVR)) as shown in the lumacontrol for long filters. Additionally, the sub-block deblocking isadjusted such that that sub-block boundaries on an 8×8 grid that areclose to a coding unit (CU) or an implicit TU boundary is restricted tomodify at most two samples on each side.

The following applies to sub-block boundaries that not are aligned withthe CU boundary.

If (mode block Q == SUBBLOCKMODE && edge !=0) {  if (!(implicitTU &&(edge == (64 / 4))))   if (edge == 2 || edge == (orthogonalLength − 2)|| edge == (56 / 4) || edge == (72 / 4))     Sp = Sq = 2;    else     Sp= Sq = 3;  else    Sp = Sq = bSideQisLargeBlk ? 5:3 }

Where edge equal to 0 corresponds to CU boundary, edge equal to 2 orequal to orthogonalLength-2 corresponds to sub-block boundary 8 samplesfrom a CU boundary, etc. Where implicit TU is true if implicit split ofTU is used.

Sample adaptive offset (SAO) is discussed. The input of SAO is thereconstructed samples after deblocking (DB). The concept of SAO is toreduce mean sample distortion of a region by first classifying theregion samples into multiple categories with a selected classifier,obtaining an offset for each category, and then adding the offset toeach sample of the category, where the classifier index and the offsetsof the region are coded in the bitstream. In HEVC and VVC, the region(the unit for SAO parameters signaling) is defined to be a CTU.

Two SAO types that can satisfy the requirements of low complexity areadopted in HEVC. Those two types are edge offset (EO) and band offset(BO), which are discussed in further detail below. An index of an SAOtype is coded (which is in the range of [0, 2]). For EO, the sampleclassification is based on comparison between current samples andneighboring samples according to 1-D directional patterns: horizontal,vertical, 135° diagonal, and 45° diagonal.

FIG. 8 shows four one dimensional (1-D) directional patterns 800 for EOsample classification: horizontal (EO class=0), vertical (EO class=1),135° diagonal (EO class=2), and 45° diagonal (EO class=3).

For a given EO class, each sample inside the CTB is classified into oneof five categories. The current sample value, labeled as “c,” iscompared with its two neighbors along the selected 1-D pattern. Theclassification rules for each sample are summarized in Table 3.Categories 1 and 4 are associated with a local valley and a local peakalong the selected 1-D pattern, respectively. Categories 2 and 3 areassociated with concave and convex corners along the selected 1-Dpattern, respectively. If the current sample does not belong to EOcategories 1-4, then it is category 0 and SAO is not applied.

TABLE 3 Sample Classification Rules for Edge Offset Category Condition 1c<a and c<b 2 ( c < a && c==b) ||(c == a && c < b) 3 ( c > a && c==b)||(c == a && c > b) 4 c > a && c > b 5 None of above

Geometry transformation-based adaptive loop filter in Joint ExplorationModel (JEM) is discussed. The input of DB is the reconstructed samplesafter DB and SAO. The sample classification and filtering process arebased on the reconstructed samples after DB and SAO.

In the JEM, a geometry transformation-based adaptive loop filter (GALF)with block-based filter adaption is applied. For the luma component, oneamong twenty-five filters is selected for each 2×2 block, based on thedirection and activity of local gradients.

The filter shape is discussed. FIG. 9 shows examples of GALF filtershapes 900, including on the left a 5×5 diamond, in the middle a 7×7diamond, and one the right a 9×9 diamond. In the JEM, up to threediamond filter shapes (as shown in FIG. 9) can be selected for the lumacomponent. An index is signaled at the picture level to indicate thefilter shape used for the luma component. Each square represents asample, and Ci (i being 0˜6 (left), 0˜12 (middle), 0˜20 (right)) denotesthe coefficient to be applied to the sample. For chroma components in apicture, the 5×5 diamond shape is always used.

Block classification is discussed. Each 2×2 block is categorized intoone out of twenty-five classes. The classification index C is derivedbased on its directionality D and a quantized value of activity Â, asfollows.

C=5D+Â.  (1)

To calculate D and Â, gradients of the horizontal, vertical and twodiagonal direction are first calculated using 1-D Laplacian.

$\begin{matrix}{{{g_{v} = {\sum\limits_{k = {i - 2}}^{i + 3}{\sum\limits_{l = {j - 2}}^{j + 3}V_{k,l}}}},{V_{k,l} = {{{2\;{R\left( {k,l} \right)}} - {R\left( {k,{l - 1}} \right)} - {R\left( {k,{l + 1}} \right)}}}},}\mspace{14mu}} & (2) \\{{{g_{h} = {\sum\limits_{k = {i - 2}}^{i + 3}{\sum\limits_{l = {j - 2}}^{j + 3}H_{k,l}}}},{H_{k,l} = {{{2\;{R\left( {k,l} \right)}} - {R\left( {{k - 1},l} \right)} - {R\left( {{k + 1},l} \right)}}}},}\mspace{11mu}} & (3) \\{{g_{d\; 1} = {\sum\limits_{k = {i - 2}}^{i + 3}{\sum\limits_{l = {j - 3}}^{j + 3}{D\; 1_{k,l}}}}},{{D\; 1_{k,l}} = {{{2\;{R\left( {k,l} \right)}} - {R\left( {{k - 1},{l - 1}} \right)} - {R\left( {{k + 1},{l + 1}} \right)}}}}} & (4) \\{{g_{d\; 2} = {\sum\limits_{k = {i - 2}}^{i + 3}{\sum\limits_{j = {j - 2}}^{j + 3}{D\; 2_{k,l}}}}},{{D\; 2_{k,l}} = {{{2\;{R\left( {k,l} \right)}} - {R\left( {{k - 1},{l + 1}} \right)} - {R\left( {{k + 1},{l - 1}} \right)}}}}} & (5)\end{matrix}$

Indices i and j refer to the coordinates of the upper left sample in the2×2 block and R(i, j) indicates a reconstructed sample at coordinate (i,j).

Then D maximum and minimum values of the gradients of horizontal andvertical directions are set as:

g _(h,v) ^(max)=max(g _(h) ,g _(v)),g _(h,v) ^(min)=min(g _(h) ,g_(v)),  (6)

g _(h,v) ^(max)=max(g _(h) ,g _(v)),g _(h,v) ^(min)=min(g _(h) ,g_(v)),  (1)

and the maximum and minimum values of the gradient of two diagonaldirections are set as:

g _(d0,d1) ^(max)=max(g _(d0) ,g _(d1)),g _(d0,d1) ^(min)=min(g _(d0) ,g_(d1)),  (7)

To derive the value of the directionality D, these values are comparedagainst each other and with two thresholds t₁ and t₂:

Step 1. If both g_(h,v) ^(max)≤t₁·g_(h,v) ^(min) and g_(d0,d1)^(max)≤t₁·g_(d0,d1) ^(min) are true, D is set to 0.Step 2. If g_(h,v) ^(max)/g_(h,v) ^(min)>g_(d0,d1) ^(max)/g_(d0,d1)^(min), continue from Step 3; otherwise continue from Step 4.Step 3. If g_(h,v) ^(max)>t₂·g_(h,v) ^(min), D is set to 2; otherwise Dis set to 1.Step 4. If g_(d0,d1) ^(max)>t₂·g_(d0,d1) ^(min), D is set to 4;otherwise D is set to 3.

The activity value A is calculated as:

$\begin{matrix}{A = {\sum\limits_{k = {i - 2}}^{i + 3}{\sum\limits_{l = {j - 2}}^{j + 3}{\left( {V_{k,l} + H_{k,l}} \right).}}}} & (8)\end{matrix}$

A is further quantized to the range of 0 to 4, inclusively, and thequantized value is denoted as Â.

For both chroma components in a picture, no classification method isapplied, i.e. a single set of ALF coefficients is applied for eachchroma component.

Geometric transformation of filter coefficients is discussed.

FIG. 10 shows relative coordinates 1000 for the 5×5 diamond filtersupport—diagonal, vertical flip, and rotation, respectively (from leftto right).

Before filtering each 2×2 block, geometric transformations such asrotation or diagonal and vertical flipping are applied to the filtercoefficients f(k, l), which is associated with the coordinate (k, l),depending on gradient values calculated for that block. This isequivalent to applying these transformations to the samples in thefilter support region. The idea is to make different blocks to which ALFis applied more similar by aligning their directionality.

Three geometric transformations, including diagonal, vertical flip, androtation are introduced:

Diagonal: f _(D)(k,l)=f(l,k),

Vertical flip: f _(V)(k,l)=f(k,K−l−1),

Rotation: f _(R)(k,l)=f(K−l−1,k).  (9)

where K is the size of the filter and 0≤k, l≤K−1 are coefficientscoordinates, such that location (0,0) is at the upper left corner andlocation (K−1, K−1) is at the lower right corner. The transformationsare applied to the filter coefficients f(k, l) depending on gradientvalues calculated for that block. The relationship between thetransformation and the four gradients of the four directions aresummarized in Table 4.

TABLE 1 Mapping of the gradient calculated for one block and thetransformations Gradient values Transformation g_(d2) < g_(d1) and g_(h)< g_(v) No transformation g_(d2) < g_(d1) and g_(v) < g_(h) Diagonalg_(d1) < g_(d2) and g_(h) < g_(v) Vertical flip g_(d1) < g_(d2) andg_(v) < g_(h) Rotation

Filter parameters signaling is discussed. In the JEM, GALF filterparameters are signalled for the first CTU, i.e., after the slice headerand before the SAO parameters of the first CTU. Up to 25 sets of lumafilter coefficients could be signalled. To reduce bits overhead, filtercoefficients of different classification can be merged. Also, the GALFcoefficients of reference pictures are stored and allowed to be reusedas GALF coefficients of a current picture. The current picture maychoose to use GALF coefficients stored for the reference pictures andbypass the GALF coefficients signalling. In this case, only an index toone of the reference pictures is signalled, and the stored GALFcoefficients of the indicated reference picture are inherited for thecurrent picture.

To support GALF temporal prediction, a candidate list of GALF filtersets is maintained. At the beginning of decoding a new sequence, thecandidate list is empty. After decoding one picture, the correspondingset of filters may be added to the candidate list. Once the size of thecandidate list reaches the maximum allowed value (i.e., 6 in currentJEM), a new set of filters overwrites the oldest set in decoding order,and that is, first-in-first-out (FIFO) rule is applied to update thecandidate list. To avoid duplications, a set could only be added to thelist when the corresponding picture does not use GALF temporalprediction. To support temporal scalability, there are multiplecandidate lists of filter sets, and each candidate list is associatedwith a temporal layer. More specifically, each array assigned bytemporal layer index (TempIdx) may compose filter sets of previouslydecoded pictures with equal to lower TempIdx. For example, the k-tharray is assigned to be associated with TempIdx equal to k, and the k-tharray only contains filter sets from pictures with TempIdx smaller thanor equal to k. After coding a certain picture, the filter setsassociated with the picture will be used to update those arraysassociated with equal or higher TempIdx.

Temporal prediction of GALF coefficients is used for inter coded framesto minimize signalling overhead. For intra frames, temporal predictionis not available, and a set of 16 fixed filters is assigned to eachclass. To indicate the usage of the fixed filter, a flag for each classis signalled and if required, the index of the chosen fixed filter. Evenwhen the fixed filter is selected for a given class, the coefficients ofthe adaptive filter f(k, l) can still be sent for this class in whichcase the coefficients of the filter which will be applied to thereconstructed image are sum of both sets of coefficients.

The filtering process of luma component can be controlled at the CUlevel. A flag is signalled to indicate whether GALF is applied to theluma component of a CU. For chroma component, whether GALF is applied ornot is indicated at picture level only.

The filtering process is discussed. At the decoder side, when GALF isenabled for a block, each sample R(i, j) within the block is filtered,resulting in sample value R′(i, j) as shown below, where L denotesfilter length, f_(m,n) represents filter coefficient, and f(k, l)denotes the decoded filter coefficients.

R′(i,j)=Σ_(k=−L/2) ^(L/2)Σ_(l=L/2) ^(L/2) f(k,l)×R(i+k,j+l)  (2)

FIG. 11 shows an example of relative coordinates used for 5×5 diamondfilter support supposing the current sample's coordinate (i, j) to be(0, 0). Samples in different coordinates filled with the same color aremultiplied with the same filter coefficients.

Geometry transformation-based adaptive loop filter (GALF) in VVC isdiscussed. In VVC test model 4.0 (VTM4.0), the filtering process of theAdaptive Loop Filter, is performed as follows:

O(x,y)=Σ_((i,j)) w(i,j)·I(x+i,y+j),  (11)

where samples I(x+i, y+j) are input samples, O(x, y) is the filteredoutput sample (i.e., filter result), and w(i,j) denotes the filtercoefficients. In practice, in VTM4.0 it is implemented using integerarithmetic for fixed point precision computations

$\begin{matrix}{{{O\left( {x,y} \right)} = {\left( {{\sum_{i = {- \frac{L}{2}}}^{\frac{L}{2}}{\sum_{j = {- \frac{L}{2}}}^{\frac{L}{2}}{{w\left( {i,j} \right)}.{I\left( {{x + i},{y + j}} \right)}}}} + 64} \right) ⪢ 7}},} & (12)\end{matrix}$

where L denotes the filter length, and where w(i,j) are the filtercoefficients in fixed point precision.

The current design of GALF in VVC has the following major changescompared to that in JEM:

-   -   1) The adaptive filter shape is removed. Only 7×7 filter shape        is allowed for luma component and 5×5 filter shape is allowed        for chroma component.    -   2) Signaling of ALF parameters in removed from slice/picture        level to CTU level.    -   3) Calculation of class index is performed in 4×4 level instead        of 2×2. In addition, as proposed in JVET-L0147, sub-sampled        Laplacian calculation method for ALF classification is utilized.        More specifically, there is no need to calculate the        horizontal/vertical/45 diagonal/135 degree gradients for each        sample within one block. Instead, 1:2 subsampling is utilized.

Non-linear ALF in the current VVC is discussed with regard to filteringreformulation.

Equation (11) can be reformulated, without coding efficiency impact, inthe following expression:

O(x,y)=I(x,y)Σ_((i,j)≠(0,0)) w(i,j)·K(I(x+i,y+j)−I(x,y)),  (3)

where w(i,j) are the same filter coefficients as in equation (11)[excepted w(0, 0) which is equal to 1 in equation (13) while it is equalto 1−Σ_((i,j)≠(0,0))w(i,j) in equation (11)].

Using the above filter formula of (13), VVC introduces the non-linearityto make ALF more efficient by using a simple clipping function to reducethe impact of neighbor sample values (I (x+i, y+j)) when they are toodifferent with the current sample value (I (x, y)) being filtered.

More specifically, the ALF filter is modified as follows:

O′(x,y)=I(x,y)+Σ_((i,j)≠(0,0)) w(i,j)·K(I(x+i,y+j)−I(x,y),k(i,j)),  (14)

where K(d, b)=min (b, max (−b, d)) is the clipping function, and k(i, j)are clipping parameters, which depends on the (i,j) filter coefficient.The encoder performs the optimization to find the best k(i, j).

In the JVET-N0242 implementation, the clipping parameters k (i, j) arespecified for each ALF filter, one clipping value is signaled per filtercoefficient. It means that up to 12 clipping values can be signalled inthe bitstream per Luma filter and up to 6 clipping values for the Chromafilter.

In order to limit the signaling cost and the encoder complexity, only 4fixed values which are the same for INTER and INTRA slices are used.

Because the variance of the local differences is often higher for Lumathan for Chroma, two different sets for the Luma and Chroma filters areapplied. The maximum sample value (here 1024 for 10 bits bit-depth) ineach set is also introduced, so that clipping can be disabled if it isnot necessary.

The sets of clipping values used in the JVET-N0242 tests are provided inthe Table 5. The 4 values have been selected by roughly equallysplitting, in the logarithmic domain, the full range of the samplevalues (coded on 10 bits) for Luma, and the range from 4 to 1024 forChroma.

More precisely, the Luma table of clipping values have been obtained bythe following formula:

$\begin{matrix}{\left. {{AlfClip}_{L} = \left\{ {{{{round}\left( \left( (M)^{\frac{1}{N}} \right)^{N - n + 1} \right)}{for}\mspace{14mu} n} \in {1..N}} \right\rbrack} \right\},{{{with}\mspace{14mu} M} = {{2^{10}\mspace{14mu}{and}\mspace{14mu} N} = 4.}}} & (15)\end{matrix}$

Similarly, the Chroma tables of clipping values is obtained according tothe following formula:

$\begin{matrix}{\left. {{AlfClip}_{C} = \left\{ {{{{round}\left( {A.\left( \left( \frac{M}{A} \right)^{\frac{1}{N - 1}} \right)^{N - n}} \right)}{for}\mspace{14mu} n} \in {1..N}} \right\rbrack} \right\},{{{with}\mspace{14mu} M} = 2^{10}},{N = {{4\mspace{14mu}{and}\mspace{14mu} A} = 4.}}} & (16)\end{matrix}$

TABLE 5 Authorized clipping values INTRA/INTER tile group LUMA {1024,181, 32, 6} CHROMA {1024, 161, 25, 4}

The selected clipping values are coded in the “alf_data” syntax elementby using a Golomb encoding scheme corresponding to the index of theclipping value in the above Table 5. This encoding scheme is the same asthe encoding scheme for the filter index.

Convolutional Neural network-based loop filters for video coding arediscussed.

In deep learning, a convolutional neural network (CNN, or ConvNet) is aclass of deep neural networks, most commonly applied to analyzing visualimagery. They have very successful applications in image and videorecognition/processing, recommender systems, image classification,medical image analysis, natural language processing.

CNNs are regularized versions of multilayer perceptrons. Multilayerperceptrons usually mean fully connected networks, that is, each neuronin one layer is connected to all neurons in the next layer. The“fully-connectedness” of these networks makes them prone to overfittingdata. Typical ways of regularization include adding some form ofmagnitude measurement of weights to the loss function. CNNs take adifferent approach towards regularization: they take advantage of thehierarchical pattern in data and assemble more complex patterns usingsmaller and simpler patterns. Therefore, on the scale of connectednessand complexity, CNNs are on the lower extreme.

CNNs use relatively little pre-processing compared to other imageclassification/processing algorithms. This means that the network learnsthe filters that in traditional algorithms were hand-engineered. Thisindependence from prior knowledge and human effort in feature design isa major advantage.

Deep learning-based image/video compression typically has twoimplications: end-to-end compression purely based on neural networks andtraditional frameworks enhanced by neural networks. End-to-endcompression purely based on neural networks are discussed in JohannesBallé, Valero Laparra, and Eero P. Simoncelli, “End-to-end optimizationof nonlinear transform codes for perceptual quality,” In: 2016 PictureCoding Symposium (PCS), pp. 1-5, Institute of Electrical and ElectronicsEngineers (IEEE) and Lucas Theis, Wenzhe Shi, Andrew Cunningham, andFerenc Huszár, “Lossy image compression with compressive autoencoders,”arXiv preprint arXiv:1703.00395 (2017). Traditional frameworks enhancedby neural networks Jiahao Li, Bin Li, Jizheng Xu, Ruiqin Xiong, and WenGao, “Fully Connected Network-Based Intra Prediction for Image Coding,”IEEE Transactions on Image Processing 27, 7 (2018), 3236-3247, YuanyingDai, Dong Liu, and Feng Wu, “A convolutional neural network approach forpost-processing in HEVC intra coding,” MMM. Springer, 28-39, Rui Song,Dong Liu, Houqiang Li, and Feng Wu, “Neural network-based arithmeticcoding of intra prediction modes in HEVC,” VCIP. IEEE, 1-4, and J.Pfaff, P. Helle, D. Maniry, S. Kaltenstadler, W. Samek, H. Schwarz, D.Marpe, and T. Wiegand, “Neural network based intra prediction for videocoding,” Applications of Digital Image Processing XLI, Vol. 10752.International Society for Optics and Photonics, 1075213.

The first type usually takes an auto-encoder like structure, eitherachieved by convolutional neural networks or recurrent neural networks.While purely relying on neural networks for image/video compression canavoid any manual optimizations or hand-crafted designs, compressionefficiency may be not satisfactory. Therefore, works distributed in thesecond type take neural networks as an auxiliary, and enhancetraditional compression frameworks by replacing or enhancing somemodules. In this way, they can inherit the merits of the highlyoptimized traditional frameworks. For example, a fully connected networkfor the intra prediction is proposed in HEVC as discussed in Jiahao Li,Bin Li, Jizheng Xu, Ruiqin Xiong, and Wen Gao, “Fully ConnectedNetwork-Based Intra Prediction for Image Coding,” IEEE Transactions onImage Processing 27, 7 (2018), p. 3236-3247.

In addition to intra prediction, deep learning is also exploited toenhance other modules. For example, the in-loop filters of HEVC arereplaced with a convolutional neural network and achieve promisingresults in Yuanying Dai, Dong Liu, and Feng Wu, “A convolutional neuralnetwork approach for post-processing in HEVC intra coding,” MMM.Springer, 28-39. The work in Rui Song, Dong Liu, Houqiang Li, and FengWu, “Neural network-based arithmetic coding of intra prediction modes inHEVC,” VCIP. IEEE, 1-4 applies neural networks to improve the arithmeticcoding engine.

Convolutional neural network based in-loop filtering is discussed. Inlossy image/video compression, the reconstructed frame is anapproximation of the original frame, since the quantization process isnot invertible and thus incurs distortion to the reconstructed frame. Toalleviate such distortion, a convolutional neural network could betrained to learn the mapping from the distorted frame to the originalframe. In practice, training must be performed prior to deploying theCNN-based in-loop filtering.

Training is discussed. The purpose of the training processing is to findthe optimal value of parameters including weights and bias.

First, a codec (e.g. HM, JEM, VTM, etc.) is used to compress thetraining dataset to generate the distorted reconstruction frames. Then,the reconstructed frames are fed into the CNN and the cost is calculatedusing the output of CNN and the groundtruth frames (original frames).Commonly used cost functions include Sum of Absolution Difference (SAD)and Mean Square Error (MSE). Next, the gradient of the cost with respectto each parameter is derived through the back propagation algorithm.With the gradients, the values of the parameters can be updated. Theabove process repeats until the convergence criteria is met. Aftercompleting the training, the derived optimal parameters are saved foruse in the inference stage.

The convolutional process is discussed. During convolution, the filteris moved across the image from left to right, top to bottom, with aone-pixel column change on the horizontal movements, then a one-pixelrow change on the vertical movements. The amount of movement betweenapplications of the filter to the input image is referred to as thestride, and it is almost always symmetrical in height and widthdimensions. The default stride or strides in two dimensions is (1,1) forthe height and the width movement.

FIG. 12A is an example architecture 1200 of the proposed CNN filter, andFIG. 12B is an example of construction 1250 of residual block(ResBlock). In most of deep convolutional neural networks, residualblocks are utilized as the basic module and stacked several times toconstruct the final network wherein in one example, the residual blockis obtained by combining a convolutional layer, a ReLU/PReLU activationfunction and a convolutional layer as shown in FIG. 12B.

Inference is discussed. During the inference stage, the distortedreconstruction frames are fed into CNN and processed by the CNN modelwhose parameters are already determined in the training stage. The inputsamples to the CNN can be reconstructed samples before or after DB, orreconstructed samples before or after SAO, or reconstructed samplesbefore or after ALF.

The current CNN-based loop filtering has the following problems. First,the output from a CNN-based in-loop filter is directly used. For certaincontent, using a linear model to scale the output may provide betterfiltering strengths. Second, an interference block size is fixed fordifferent video content or under different compression settings. It maybe beneficial to use finer granularities for sequences with lowerresolutions or at higher bit rates. Third, how to combine the outputs ofseveral models has not been fully explored.

Disclosed herein are techniques that solve one or more of the foregoingproblems. For example, the present disclosure provides one or moreneural network (NN) filter models trained as part of an in-loopfiltering technology or filtering technology used in a post-processingstage for reducing the distortion incurred during compression. Inaddition, samples with different characteristics are processed bydifferent NN filter models. The present disclosure also elaborates howto scale the output of NN filters to achieve better performance, how toset an interference block size, and how to combine the output ofmultiple NN filter models.

Video coding is a lossy process. Convolutional Neural Networks (CNN) canbe trained to recover detail lost in the compression process. That is,artificial intelligence (AI) processes can create CNN filters based ontraining data.

Different CNN filters work best for different situations. The encoderand the decoder have access to a plurality of CNN filters that have beentrained ahead of time (a.k.a., pre-trained). The present disclosuredescribes methods and techniques to allow the encoder to signal to thedecoder which CNN filter to use for each video unit. The video unit maybe a sequence of pictures, a picture, a slice, a tile, a brick, asub-picture, a coding tree unit (CTU), a CTU row, a coding unit (CU),etc. As an example, different CNN filters can be used for differentlayers, different components (e.g., luma, chroma, Cb, Cr, etc.),different specific video units, etc. Flags and/or indices can besignaled to indicate which CNN filter should be used for each videoitem. The CNN filters can be signaled based on whether a neighbor videounit uses the filter. Inheritance of CNN filters between parent andchild nodes when trees are used to partition video units is alsoprovided.

The listing of embodiments below should be considered as examples toexplain general concepts. These embodiments should not be interpreted ina narrow way. Furthermore, these embodiments can be combined in anymanner.

In the disclosure, a NN filter can be any kind of NN filter, such as aconvolutional neural network (CNN) filter. In the following discussion,an NN filter may also be referred to as a CNN filter.

In the following discussion, a video unit may be a sequence, a picture,a slice, a tile, a brick, a subpicture, a CTU/CTB, a CTU/CTB row, one ormultiple CUs/coding blocks (CBs), one or multiple CTUs/CTBs, one ormultiple Virtual Pipeline Data Unit (VPDU), a sub-region within apicture/slice/tile/brick. A father video unit represents a unit largerthan the video unit. Typically, a father unit will contain several videounits, for example, when the video unit is CTU, the father unit could beslice, CTU row, multiple CTUs, etc. In some embodiments, the video unitmay be a sample/pixel.

FIGS. 13A-D are examples of processes for generating filtered samplesusing residual scaling and neural network filtering. In FIG. 13A, theresidual is the output of NN filters. In the process 1300 shown in FIG.13A, some of the unfiltered samples are input into an NN filter and asummation device. In an embodiment, an unfiltered sample is a sample(e.g., pixel) that has not been subjected any filtering. The output ofthe NN filter is the residual (or is used to generate the residual). Aresidual scaling function (e.g., linear/nonlinear) is applied to theresidual. The summation device combines the scaled residual with some ofthe unfiltered samples (which bypassed the NN filter) and outputsfiltered samples.

In FIG. 13B, the residual is the difference between the output of NNfilter and unfiltered sample. In the process 1320 shown in FIG. 13B,some of the unfiltered samples are input into an NN filter, a differencedevice, and a summation device. The output of the NN filter is inputinto the difference device. The difference between the output of the NNfilter and the unfiltered samples is the residual. A residual scalingfunction (e.g., linear/nonlinear) is applied to the residual. Thesummation device combines the scaled residual with some of theunfiltered samples (which bypassed the NN filter) and outputs filteredsamples.

In the process 1340 shown in FIG. 13C, some of the unfiltered samplesare input into an NN filter and summation devices. The output of the NNfilter is the residual (or is used to generate the residual). When theswitch is in the position shown in FIG. 13C, a residual scaling function(e.g., linear/nonlinear) is applied to the residual. Thereafter, one ofthe summation devices combines the scaled residual with some of theunfiltered samples and outputs filtered samples. Alternatively, theswitch may be positioned to provide the residuals directly to another ofthe summation devices, which combines the residuals with some of theunfiltered samples to generate the filtered samples.

In the process 1360 shown in FIG. 13D, some of the unfiltered samplesare input into an NN filter, a difference device, and summation devices.The output of the NN filter is input into the difference device. Thedifference between the output of the NN filter and the unfilteredsamples is the residual. When the switch is in the position shown inFIG. 13D, a residual scaling function (e.g., linear/nonlinear) isapplied to the residual. Thereafter, one of the summation devicescombines the scaled residual with some of the unfiltered samples andoutputs filtered samples. Alternatively, the switch may be positioned toprovide the residuals directly to another of the summation devices,which combines the residuals with some of the unfiltered samples togenerate the filtered samples.

A discussion of the model selection is provided.

Example 1

1. A residual value which is determined by output of NN filters may befirstly revised according to a function (e.g., being scaled) and thenadded to the corresponding unfiltered sample in a video unit to generatethe final filtered sample.

a. In one example, unfiltered samples are the reconstruction prior to NNfiltering.

b. In one example, the residual is the output of NN filters as shown inFIG. 13A. Denote the unfiltered sample as X and the output of NN filtersas R, then filtering process is defined as: Y=X+F(R), where Y is thefiltered sample, F represents the function (e.g., residual scalingoperation) and will be elaborated soon.

c. In one example, the input of the function may comprise at least theoutput of NN filter and unfiltered sample. Denote the unfiltered samplesas X and the output of NN filters as R, then filtering process isdefined as: Y=X+F(R, X), where Y is the filtered samples, F representsthe function (e.g., residual scaling operation) and will be elaboratedsoon.

d. In one example, the residual is the difference between the output ofNN filter and unfiltered sample as shown in FIG. 13B. Denote theunfiltered sample as X and the output of NN filters as R, then filteringprocess is defined as: Y=X+F(R−X), where Y is the filtered samples, Frepresents the function (e.g., residual scaling operation) and will beelaborated soon.

e. In one example, Y=Clip(X+F(R)), wherein X and Y are the unfilteredsample and filtered sample, respectively. F represents the function(e.g., residual scaling operation). Clip is a clipping operation. Forexample, Clip(w)=max(0, min((1<<B)−1, w)), wherein B is the bit depth ofthe filtered sample. Bit depth (a.k.a., color depth) describes theamount of information stored in each pixel of data. In an embodiment,bit depth is either the number of bits used to indicate the color of asingle pixel, in a bitmapped image or video framebuffer, or the numberof bits used for each color component of a single pixel.

f. In one example, residual scaling is characterized by a linear modelcontaining two coefficients, i.e. F(Residual)=α×Residual+β wherein thepair of (α, β) are called one coefficient candidate which may bepre-defined or derived on-the-fly.

i. In one example, the (α, β) may be set to (1, 0) which indicates thatresidual scaling is off/disabled as shown in FIGS. 13C-13D.

ii. Alternatively, F(Residual)=α×Residual+β may be replaced byF(Residual)=(Residual>>α)+β.

1) Alternatively, F(Residual)=α×Residual+β may be replaced byF(Residual)=(Residual<<α)+β.

2) In one example, the (α, β) may be set to (0, 0) which indicates thatresidual scaling is off/disabled as shown in FIGS. 13C-13D.

iii. In one example, the (α, β) may be fixed for samples within a videounit.

1) Alternatively, the (α, β) may be different for different sampleswithin a video unit.

iv. In another example, F(Residual)=((α×Residual+offset)>>s)+β, whereins is a scaling factor which may be predefined. offset is an integer suchas 1<<(s−1).

v. In another example, F(Residual)=((α×Residual+β+offset)>>s), wherein sis a scaling factor which may be predefined. offset is an integer suchas 1<<(s−1).

vi. In one example, the output of the function may be clipped to a validrange.

vii. Alternatively, furthermore, there are N predefined coefficientscandidates {α₀, β₀}, {α₁, β₁}, . . . , {α_(N-1), β_(N-1)}.

viii. In one example, for a video unit, the coefficient candidate may bedetermined according to decoded information, such as the QPinformation/prediction mode/reconstructed samples information/colorcomponent/color formats/temporal layer/slice or picture type. In anembodiment, the picture type refers to an instantaneous decoder refresh(IDR) picture, a broken link access (BLA) picture, a clean random access(CRA) picture, a random access decodable leading picture (RADL), arandom access skipped leading picture (RASL), etc. In an embodiment, thetemporal layer is a hierarchical layer in scalable video coding (e.g.,layer 0, layer 1, layer 2, etc.)

ix. In one example, for a video unit, indicators of one or morecoefficients (e.g., indices) are signaled to indicate the selection fromcandidates.

1) Alternatively, furthermore, the indicators may be conditionallysignaled, e.g., according to whether NN filter is applied to the videounit.

x. In one example, the luma and chroma components in video unit may usedifferent sets of coefficients candidates.

xi. In one example, the same number of coefficients candidates areallowed for the luma and chroma components, but the coefficientscandidates are different for the luma and chroma components.

xii. In one example, the chroma components (such as Cb and Cr or U andV) in a video unit may share the same coefficients candidates.

xiii. In one example, the coefficients candidates may be different fordifferent video units (e.g.,sequences/pictures/slices/tiles/bricks/subpictures/CTUs/CTU rows/CUs).

xiv. In one example, the coefficients candidates may be dependent on thetree partition structure (e.g., dual tree or single tree), the slicetype or the quantization parameter (QP). In an embodiment, the QPdetermines the step size for associating the transformed coefficientswith a finite set of steps. The QP may be in a range of, for example, 0to 51. In an embodiment, the slice types are, for example, an I slice (aslice with only intra prediction), a P slice (a slice with interprediction from one I or P slice), and a B slice (a slice with interprediction from two I or P slices).

xv. In one example, more than one coefficient candidates may be usedand/or signaled for one video unit.

xvi. In one example, samples in one video unit may be grouped into Ngroups and each group use its own coefficient candidate. In one example,different color components (including luma and chroma) in a video unitmay share the same one or multiple signaled coefficients indices.

1) Alternatively, a coefficient index is signaled for each colorcomponent in a video unit.

2) Alternatively, a first coefficients index is signaled for the firstcolor component (such as luma) and a second coefficients index issignaled for the second and the third color components (such as Cb andCr, or U and V).

3) Alternatively, an indicator (e.g., a flag) is signaled to indicate ifall color components will share the same coefficients index.

a. In one example, when the flag is true, one coefficients index issignaled for the video unit. Otherwise, coefficients index is signaledaccording to the above bullets.

4) Alternatively, an indicator (e.g., a flag) is signaled to indicate iftwo components (e.g. the second and the third color components, or Cband Cr, or U and V) will share the same coefficients index.

a. In one example, when the flag is true, one coefficients index issignaled for the two components. Otherwise, an individual coefficientsindex will be signaled for each of the two components.

5) Alternatively, an indicator (e.g., a flag) is signaled to indicate ifresidual scaling will be used for the current video unit.

a. In one example, if the flag is false, residual scaling will not beapplied on current video unit, meaning no transmission of anycoefficients index. Otherwise, coefficients index is signaled accordingto the above bullets.

6) Alternatively, an indicator (e.g., a flag) is signaled to indicate ifresidual scaling will be used for the two components in current videounit (e.g. the second and the third color components, or Cb and Cr, or Uand V).

a. In one example, if the flag is false, residual scaling will not beapplied on the two components, meaning no transmission of anycoefficients index for the two components. Otherwise, coefficients indexis signaled according to the above bullets.

xvii. The coefficients index may be coded with one or more contexts inarithmetic coding.

1) In one example, the coefficients index may be binarized to a binstring, and at least one bin may be coded with one or more contexts.

2) Alternatively, the coefficients index may be firstly binarized to abin string, and at least one bin may be coded with bypass mode.

3) The context may be derived from coding information of the currentunit and/or neighboring units.

xviii. The coefficients index may be binarized with a fixed length code,or a unary code, or a truncated unary code, or an Exponential-Golombcode (e.g., K-th EG code, wherein K=0), or a truncatedExponential-Golomb code, or a truncated binary code.

xix. In one example, coefficients indices may be coded in a predictiveway.

1) For example, a previously coded/decoded coefficients index may beused as a prediction for the current coefficients index.

2) A flag may be singled to indicate whether the current coefficientsindex is equal to the previously coded/decoded coefficients index.

xx. In one example, coefficients indices in a current video unit may beinherited from previously coded/neighboring video units.

1) In one example, denote the number of previously coded/neighboringvideo unit candidates as C. An inheritance index (range from 0 to C−1)is then signaled for the current video unit to indicate the candidate tobe inherited.

xxi. In one example, residual scaling on/off control of the currentvideo unit may be inherited from previously coded/neighboring videounits.

xxii. In one example, a first indicator may be signaled in a father unitto indicate how coefficients index will be signaled for each video unitcontained in the father unit, or how residual scaling will be used foreach video unit contained in the father unit.

1) In one example, the first indicator may be used to indicate whetherall samples within the father unit share the same on/off control.

2) Alternatively, furthermore, a second indicator of a video unit withinthe father unit to indicate the usage of residual scaling may beconditionally signaled based on the first indicator.

3) In one example, the first indicator may be used to indicate whichcoefficients index is used for all samples within the father unit.

4) In one example, the first indicator may be used to indicate whetherto further signal coefficients indices of a video unit within the fatherunit.

5) In one example, the indicator may have K+2 options, where K is anumber of coefficients candidates.

a) In one example, when the indicator is 0, residual scaling is disabledfor all the video units contained in the father unit.

b) In one example, when the indicator is i (1≤i≤K), the i^(th)coefficients will be used for all the video units contained in thefather unit. Obviously, for the K options just mentioned, it is notnecessary to signal any coefficients index for any video units containedin the father unit.

c) In one example, when the indicator is K+1, coefficients index will besignaled for each video unit contained in the father unit.

Example 2

2. In a second embodiment, the inference block size, which refers to thegranularity when applying NN filter, can be derived implicitly orexplicitly for a video unit (e.g., a slice/picture/tile/subpicture).Inference applies knowledge from a trained neural network model and usesthat knowledge to infer a result. In an embodiment, the inference blocksize is the block size determined based on the knowledge of the CNN.

a. In one example, there are several inference block size candidates fora video unit (e.g., a slice/picture/tile/subpicture).

i. In one example, the inference block size candidates may bepre-defined or associated with certain information (e.g., QP/slice orpicture type/partition tree/color component). A partition tree is ahierarchical data structure formed by recursively partitioning a videounit into smaller video units (e.g., partitioning a block intosub-blocks). The partition tree may comprise a series of branches andleaves.

b. In one example, at least one indicator (e.g., an index) is signaledfor the video unit to indicate which candidate will be used.

c. In one example, inference block size may be derived on-the-fly.

i. In one example, it may be dependent on quantization parameters (QPs)or/and resolution of video sequences.

ii. In one example, inference block size is set larger at low bit rate(i.e. high QPs), and vice versa.

iii. In one example, inference block size is set larger for highresolution sequences, and vice versa.

d. In one example, different networks may use different inference blocksizes.

i. The networks may share some parts, e.g. may share some connectionlayers.

e. In one example, one network can use different inference block sizes.

Example 3

3. In a third embodiment, for a sample to be filtered, instead ofapplying one NN filter model, multiple NN filter models may be appliedto derive the filtered sample.

a. In one example, the outputs of multiple NN filter models are weightedsummed (e.g., linearly, or non-linearly) to derive the final filteredoutput for a sample.

i. Alternatively, the parameters associated with multiple NN filtermodels may be firstly used to derive a new NN filter model, and the newNN filter model is utilized to derive the filtered sample.

b. In one example, indication of one or multiple weights and/or multipleNN filter models to be applied may be signaled in the bitstream.

i. Alternatively, the weights may be derived on-the-fly without beingsignaled.

c. In one example, weights are equal across different NN filter models.

d. In one example, weights are dependent on QPs or/and slice or picturetypes/color components/color formats/temporal layers.

e. In one example, weights are dependent on NN filter models.

f. In one example, weights are dependent on inference block sizes.

g. In one example, weights are different across different spatiallocations. In an embodiment, a spatial location is a location of oneelement relative to another (e.g., the location of a pixel within apicture).

i. In one example, there are two NN filter models, which are trainedbased on boundary strengths and on other information, respectively. Forthe model trained based on boundary strengths, the weights are sethigher (e.g., 1) for boundary samples and lower (e.g., 0) for innersamples. For the other model, the weights are set lower (e.g., 0) forboundary samples and higher (e.g., 1) for inner samples.

FIG. 14 is a block diagram showing an example video processing system1400 in which various techniques disclosed herein may be implemented.Various implementations may include some or all of the components of thevideo processing system 1400. The video processing system 1400 mayinclude input 1402 for receiving video content. The video content may bereceived in a raw or uncompressed format, e.g., 8 or 10 bitmulti-component pixel values, or may be in a compressed or encodedformat. The input 1402 may represent a network interface, a peripheralbus interface, or a storage interface. Examples of network interfaceinclude wired interfaces such as Ethernet, passive optical network(PON), etc. and wireless interfaces such as Wi-Fi or cellularinterfaces.

The video processing system 1400 may include a coding component 1404that may implement the various coding or encoding methods described inthe present document. The coding component 1404 may reduce the averagebitrate of video from the input 1402 to the output of the codingcomponent 1404 to produce a coded representation of the video. Thecoding techniques are therefore sometimes called video compression orvideo transcoding techniques. The output of the coding component 1404may be either stored, or transmitted via a communication connected, asrepresented by the component 1406. The stored or communicated bitstream(or coded) representation of the video received at the input 1402 may beused by the component 1408 for generating pixel values or displayablevideo that is sent to a display interface 1410. The process ofgenerating user-viewable video from the bitstream representation issometimes called video decompression. Furthermore, while certain videoprocessing operations are referred to as “coding” operations or tools,it will be appreciated that the coding tools or operations are used atan encoder and corresponding decoding tools or operations that reversethe results of the coding will be performed by a decoder.

Examples of a peripheral bus interface or a display interface mayinclude universal serial bus (USB) or high definition multimediainterface (HDMI) or Displayport, and so on. Examples of storageinterfaces include SATA (serial advanced technology attachment),Peripheral Component Interconnect (PCI), Integrated Drive Electronics(IDE) interface, and the like. The techniques described in the presentdocument may be embodied in various electronic devices such as mobilephones, laptops, smartphones or other devices that are capable ofperforming digital data processing and/or video display.

FIG. 15 is a block diagram of a video processing apparatus 1500. Theapparatus 1500 may be used to implement one or more of the methodsdescribed herein. The apparatus 1500 may be embodied in a smartphone,tablet, computer, Internet of Things (IoT) receiver, and so on. Theapparatus 1500 may include one or more processors 1502, one or morememories 1504 and video processing hardware 1506 (a.k.a., videoprocessing circuitry). The processor(s) 1502 may be configured toimplement one or more methods described in the present document. Thememory (memories) 1504 may be used for storing data and code used forimplementing the methods and techniques described herein. The videoprocessing hardware 1506 may be used to implement, in hardwarecircuitry, some techniques described in the present document. In someembodiments, the hardware 1506 may be partly or completely locatedwithin the processor 1502, e.g., a graphics processor.

FIG. 16 is a block diagram that illustrates an example video codingsystem 1600 that may utilize the techniques of this disclosure. As shownin FIG. 16, the video coding system 1600 may include a source device1610 and a destination device 1620. Source device 1610 generates encodedvideo data which may be referred to as a video encoding device.Destination device 1620 may decode the encoded video data generated bysource device 1610 which may be referred to as a video decoding device.

Source device 1610 may include a video source 1612, a video encoder1614, and an input/output (I/O) interface 1616.

Video source 1612 may include a source such as a video capture device,an interface to receive video data from a video content provider, and/ora computer graphics system for generating video data, or a combinationof such sources. The video data may comprise one or more pictures. Videoencoder 1614 encodes the video data from video source 1612 to generate abitstream. The bitstream may include a sequence of bits that form acoded representation of the video data. The bitstream may include codedpictures and associated data. The coded picture is a codedrepresentation of a picture. The associated data may include sequenceparameter sets, picture parameter sets, and other syntax structures. I/Ointerface 1616 may include a modulator/demodulator (modem) and/or atransmitter. The encoded video data may be transmitted directly todestination device 1620 via I/O interface 1616 through network 1630. Theencoded video data may also be stored onto a storage medium/server 1640for access by destination device 1620.

Destination device 1620 may include an I/O interface 1626, a videodecoder 1624, and a display device 1622.

I/O interface 1626 may include a receiver and/or a modem. I/O interface1626 may acquire encoded video data from the source device 1610 or thestorage medium/server 1640. Video decoder 1624 may decode the encodedvideo data. Display device 1622 may display the decoded video data to auser. Display device 1622 may be integrated with the destination device1620, or may be external to destination device 1620 which may beconfigured to interface with an external display device.

Video encoder 1614 and video decoder 1624 may operate according to avideo compression standard, such as the High Efficiency Video Coding(HEVC) standard, Versatile Video Coding (VVC) standard, and othercurrent and/or further standards.

FIG. 17 is a block diagram illustrating an example of video encoder1700, which may be video encoder 1614 in the video coding system 1600illustrated in FIG. 16.

Video encoder 1700 may be configured to perform any or all of thetechniques of this disclosure. In the example of FIG. 17, video encoder1700 includes a plurality of functional components. The techniquesdescribed in this disclosure may be shared among the various componentsof video encoder 1700. In some examples, a processor may be configuredto perform any or all of the techniques described in this disclosure.

The functional components of video encoder 1700 may include a partitionunit 1701, a prediction unit 1702 which may include a mode select unit1703, a motion estimation unit 1704, a motion compensation unit 1705 andan intra prediction unit 1706, a residual generation unit 1707, atransform unit 1708, a quantization unit 1709, an inverse quantizationunit 1710, an inverse transform unit 1711, a reconstruction unit 1712, abuffer 1713, and an entropy encoding unit 1714.

In other examples, video encoder 1700 may include more, fewer, ordifferent functional components. In an example, prediction unit 1702 mayinclude an intra block copy (IBC) unit. The IBC unit may performprediction in an IBC mode in which at least one reference picture is apicture where the current video block is located.

Furthermore, some components, such as motion estimation unit 1704 andmotion compensation unit 1705 may be highly integrated, but arerepresented in the example of FIG. 17 separately for purposes ofexplanation.

Partition unit 1701 may partition a picture into one or more videoblocks. Video encoder 1614 and video decoder 1624 of FIG. 16 may supportvarious video block sizes.

Mode select unit 1703 may select one of the coding modes, intra orinter, e.g., based on error results, and provide the resulting intra- orinter-coded block to a residual generation unit 1707 to generateresidual block data and to a reconstruction unit 1712 to reconstruct theencoded block for use as a reference picture. In some examples, modeselect unit 1703 may select a combination of intra and inter prediction(CIIP) mode in which the prediction is based on an inter predictionsignal and an intra prediction signal. Mode select unit 1703 may alsoselect a resolution for a motion vector (e.g., a sub-pixel or integerpixel precision) for the block in the case of inter-prediction.

To perform inter prediction on a current video block, motion estimationunit 1704 may generate motion information for the current video block bycomparing one or more reference frames from buffer 1713 to the currentvideo block. Motion compensation unit 1705 may determine a predictedvideo block for the current video block based on the motion informationand decoded samples of pictures from buffer 1713 other than the pictureassociated with the current video block.

Motion estimation unit 1704 and motion compensation unit 1705 mayperform different operations for a current video block, for example,depending on whether the current video block is in an I slice, a Pslice, or a B slice. I-slices (or I-frames) are the least compressiblebut don't require other video frames to decode. S-slices (or P-frames)can use data from previous frames to decompress and are morecompressible than I-frames. B-slices (or B-frames) can use both previousand forward frames for data reference to get the highest amount of datacompression.

In some examples, motion estimation unit 1704 may performuni-directional prediction for the current video block, and motionestimation unit 1704 may search reference pictures of list 0 or list 1for a reference video block for the current video block. Motionestimation unit 1704 may then generate a reference index that indicatesthe reference picture in list 0 or list 1 that contains the referencevideo block and a motion vector that indicates a spatial displacementbetween the current video block and the reference video block. Motionestimation unit 1704 may output the reference index, a predictiondirection indicator, and the motion vector as the motion information ofthe current video block. Motion compensation unit 1705 may generate thepredicted video block of the current block based on the reference videoblock indicated by the motion information of the current video block.

In other examples, motion estimation unit 1704 may performbi-directional prediction for the current video block, motion estimationunit 1704 may search the reference pictures in list 0 for a referencevideo block for the current video block and may also search thereference pictures in list 1 for another reference video block for thecurrent video block. Motion estimation unit 1704 may then generatereference indexes that indicate the reference pictures in list 0 andlist 1 containing the reference video blocks and motion vectors thatindicate spatial displacements between the reference video blocks andthe current video block. Motion estimation unit 1704 may output thereference indexes and the motion vectors of the current video block asthe motion information of the current video block. Motion compensationunit 1705 may generate the predicted video block of the current videoblock based on the reference video blocks indicated by the motioninformation of the current video block.

In some examples, motion estimation unit 1704 may output a full set ofmotion information for decoding processing of a decoder.

In some examples, motion estimation unit 1704 may not output a full setof motion information for the current video. Rather, motion estimationunit 1704 may signal the motion information of the current video blockwith reference to the motion information of another video block. Forexample, motion estimation unit 1704 may determine that the motioninformation of the current video block is sufficiently similar to themotion information of a neighboring video block.

In one example, motion estimation unit 1704 may indicate, in a syntaxstructure associated with the current video block, a value thatindicates to the video decoder 1624 that the current video block has thesame motion information as another video block.

In another example, motion estimation unit 1704 may identify, in asyntax structure associated with the current video block, another videoblock and a motion vector difference (MVD). The motion vector differenceindicates a difference between the motion vector of the current videoblock and the motion vector of the indicated video block. The videodecoder 1624 may use the motion vector of the indicated video block andthe motion vector difference to determine the motion vector of thecurrent video block.

As discussed above, video encoder 1614 may predictively signal themotion vector. Two examples of predictive signaling techniques that maybe implemented by video encoder 1614 include advanced motion vectorprediction (AMVP) and merge mode signaling.

Intra prediction unit 1706 may perform intra prediction on the currentvideo block. When intra prediction unit 1706 performs intra predictionon the current video block, intra prediction unit 1706 may generateprediction data for the current video block based on decoded samples ofother video blocks in the same picture. The prediction data for thecurrent video block may include a predicted video block and varioussyntax elements.

Residual generation unit 1707 may generate residual data for the currentvideo block by subtracting (e.g., indicated by the minus sign) thepredicted video block(s) of the current video block from the currentvideo block. The residual data of the current video block may includeresidual video blocks that correspond to different sample components ofthe samples in the current video block.

In other examples, there may be no residual data for the current videoblock, for example in a skip mode, and residual generation unit 1707 maynot perform the subtracting operation.

Transform unit 1708 may generate one or more transform coefficient videoblocks for the current video block by applying one or more transforms toa residual video block associated with the current video block.

After transform unit 1708 generates a transform coefficient video blockassociated with the current video block, quantization unit 1709 mayquantize the transform coefficient video block associated with thecurrent video block based on one or more quantization parameter (QP)values associated with the current video block.

Inverse quantization unit 1710 and inverse transform unit 1711 may applyinverse quantization and inverse transforms to the transform coefficientvideo block, respectively, to reconstruct a residual video block fromthe transform coefficient video block. Reconstruction unit 1712 may addthe reconstructed residual video block to corresponding samples from oneor more predicted video blocks generated by the prediction unit 1702 toproduce a reconstructed video block associated with the current blockfor storage in the buffer 1713.

After reconstruction unit 1712 reconstructs the video block, loopfiltering operation may be performed to reduce video blocking artifactsin the video block.

Entropy encoding unit 1714 may receive data from other functionalcomponents of the video encoder 1700. When entropy encoding unit 1714receives the data, entropy encoding unit 1714 may perform one or moreentropy encoding operations to generate entropy encoded data and outputa bitstream that includes the entropy encoded data.

FIG. 18 is a block diagram illustrating an example of video decoder1800, which may be video decoder 1624 in the video coding system 1600illustrated in FIG. 16.

The video decoder 1800 may be configured to perform any or all of thetechniques of this disclosure. In the example of FIG. 18, the videodecoder 1800 includes a plurality of functional components. Thetechniques described in this disclosure may be shared among the variouscomponents of the video decoder 1800. In some examples, a processor maybe configured to perform any or all of the techniques described in thisdisclosure.

In the example of FIG. 18, video decoder 1800 includes an entropydecoding unit 1801, a motion compensation unit 1802, an intra predictionunit 1803, an inverse quantization unit 1804, an inverse transformationunit 1805, and a reconstruction unit 1806 and a buffer 1807. Videodecoder 1800 may, in some examples, perform a decoding pass generallyreciprocal to the encoding pass described with respect to video encoder1614 (FIG. 16).

Entropy decoding unit 1801 may retrieve an encoded bitstream. Theencoded bitstream may include entropy coded video data (e.g., encodedblocks of video data). Entropy decoding unit 1801 may decode the entropycoded video data, and from the entropy decoded video data, motioncompensation unit 1802 may determine motion information including motionvectors, motion vector precision, reference picture list indexes, andother motion information. Motion compensation unit 1802 may, forexample, determine such information by performing the AMVP and mergemode signaling.

Motion compensation unit 1802 may produce motion compensated blocks,possibly performing interpolation based on interpolation filters.Identifiers for interpolation filters to be used with sub-pixelprecision may be included in the syntax elements.

Motion compensation unit 1802 may use interpolation filters as used byvideo encoder 1614 during encoding of the video block to calculateinterpolated values for sub-integer pixels of a reference block. Motioncompensation unit 1802 may determine the interpolation filters used byvideo encoder 1614 according to received syntax information and use theinterpolation filters to produce predictive blocks.

Motion compensation unit 1802 may use some of the syntax information todetermine sizes of blocks used to encode frame(s) and/or slice(s) of theencoded video sequence, partition information that describes how eachmacroblock of a picture of the encoded video sequence is partitioned,modes indicating how each partition is encoded, one or more referenceframes (and reference frame lists) for each inter-encoded block, andother information to decode the encoded video sequence.

Intra prediction unit 1803 may use intra prediction modes for examplereceived in the bitstream to form a prediction block from spatiallyadjacent blocks. Inverse quantization unit 1804 inverse quantizes, i.e.,de-quantizes, the quantized video block coefficients provided in thebitstream and decoded by entropy decoding unit 1801. Inverse transformunit 1805 applies an inverse transform.

Reconstruction unit 1806 may sum the residual blocks with thecorresponding prediction blocks generated by motion compensation unit1802 or intra-prediction unit 1803 to form decoded blocks. If desired, adeblocking filter may also be applied to filter the decoded blocks inorder to remove blockiness artifacts. The decoded video blocks are thenstored in buffer 1807, which provides reference blocks for subsequentmotion compensation/intra prediction and also produces decoded video forpresentation on a display device.

FIG. 19 is a method 1900 for coding video data according to anembodiment of the disclosure. The method 1900 may be performed by acoding apparatus (e.g., an encoder) having a processor and a memory. Themethod 1900 may be implemented scaling the output of NN filters toachieve better performance, setting an interference block size, andcombining the output of multiple NN filter models.

In block 1902, the coding apparatus applies an output of a neuralnetwork (NN) filter to an unfiltered sample of a video unit to generatea residual. In an embodiment, an unfiltered sample is a sample (orpixel) that has not been subjected to any filtering process. Forexample, the unfiltered sample has not been subjected to any an NNfilter. As another example, the unfiltered sample has not been subjectedto an NN filter, an adaptive Loop Filter (ALF), a deblocking filter(DF), a sample adaptive offset (SAO) filter, or combinations thereof.

In block 1904, the coding apparatus applies a scaling function to theresidual to generate a scaled residual. In an embodiment, the scaledresidual is a residual that has been subjected to a scaling function orscaling process (e.g., as part of Scalable Video Coding (SVC), etc.).SVC standardizes the encoding of a high-quality video bitstream thatalso contains one or more subset bitstreams (e.g., a form of layeredcoding). A subset video bitstream is derived by dropping packets fromthe larger video to reduce the bandwidth required for the subsetbitstream. The subset bitstream can represent a lower spatial resolution(smaller screen), lower temporal resolution (lower frame rate), or lowerquality video signal.

In block 1906, the coding apparatus adds another unfiltered sample tothe scaled residual to generate a filtered sample. In an embodiment, theunfiltered sample added to the scaled residual is different than theunfiltered sample subjected to the NN filter in block 1902. In block1908, the coding apparatus converts between a video media file and abitstream based on the filtered sample that was generated.

When implemented in an encoder, converting includes receiving a mediafile (e.g., a video unit) and encoding a filtered sample into abitstream. When implemented in a decoder, converting includes receivinga bitstream including a filtered sample, and decoding the bitstream toobtain the filtered sample.

In an embodiment, the method 1900 may utilize or incorporate one or moreof the features or processes of the other methods disclosed herein.

A listing of solutions preferred by some embodiments is provided next.

The following solutions show example embodiments of techniques discussedin the present disclosure (e.g., Example 1).

1. A method of video processing, comprising: generating, for aconversion between a video comprising a video unit and a bitstreamrepresentation of the video, final filtered samples of the video unit,wherein the final filtered samples of the video unit correspond to aresult of adding revised residual values to unfiltered sample values ofthe video unit; wherein the revised residual values correspond to anoutput of applying a function on residual values for the video unit;wherein the residual values are based on an output of a neural network(NN) filter applied to the unfiltered samples of the video unit. Variousoptions listed below are further depicted with reference to FIGS.13A-13D. Here, the final filtered samples may be used for furtherprocessing such as storage or display, and/or used as reference videofor subsequent video coding.

2. The method of claim 1, wherein the unfiltered sample samplescorrespond to reconstructed video samples of the video unit.

3. The method of claim 1, wherein the generating is represented asY=X+F(R), wherein X represents the unfiltered sample values, Rrepresents the output of the NN filter, F represents the function and Yrepresents the final filtered sample values.

4. The method of claim 1, wherein the generating is represented asY=X+F(R, X), wherein X represents the unfiltered sample values, Rrepresents the output of the NN filter, F represents the function and Yrepresents the final filtered sample values.

5. The method of claim 1, wherein the generating is represented asY=X+F(R−X), wherein X represents the unfiltered sample values, Rrepresents the output of the NN filter, F represents the function and Yrepresents the final filtered sample values.

6. The method of claim 1, wherein the generating is represented asY=Clip (X+F), wherein X represents the unfiltered sample values, Frepresents the output of the applying the function and Y represents thefinal filtered sample values.

7. The method of claim 6, wherein F(Residual)=α×Residual+β where (α, β)are numbers that are pre-defined or are derived on-the-fly.

The following solutions show example embodiments of techniques discussedin the previous section (e.g., Example 2).

8. A method of video processing, comprising: determining, for aconversion between a video comprising a video unit and a bitstream ofthe video, an inference block size used for applying a neural networkfilter to unfiltered samples of the video unit according to a rule, andperforming the conversion based on the determining.

9. The method of claim 8, wherein the rule specifies that the inferenceblock size is indicated in the bitstream.

10. The method of claim 8, wherein the rule specifies that the inferenceblock size is based on a coding information of the block.

11. The method of claim 10, wherein the inference block size isdependent on a quantization parameter or a slice type of a picture typeor a partition tree type or a color component of the video unit.

12. The method of claim 8, further including determining one or moreadditional inference block sizes for one or more additional neuralnetwork filters associated with the video unit.

The following solutions show example embodiments of techniques discussedin the previous section (e.g., Example 3).

13. A method of video processing, comprising: performing a conversionbetween a video comprising a video unit and a bitstream of the videoaccording to a rule, wherein the rule specifies that reconstructedsamples of the video unit are determined from filtering using multipleneural filter models.

14. The method of claim 13, wherein the rule specifies that thereconstructed samples are determined using a weighted sum of outputs ofthe multiple filtering.

15. The method of claim 14, wherein weights used for the weighted sumare indicated in the bitstream.

16. The method of claim 14, wherein the weighted sum uses equal weightsfor the multiple neural network models.

17. The method of claim 13, wherein weights used for the weighted sumare a function of a quantization parameter or a slice type or a picturetype or a color component or a color format or a temporal layer of thevideo unit.

18. The method of claim 13, wherein weights used for the weighted sumare dependent on type of models of the multiple neural network models.

19. The method of claim 13, wherein weights used for the weighted sumare dependent on inference block sizes.

20. The method of claim 13, wherein weights used for the weighted sumare different in different spatial locations.

21. The method of any of previous claims, wherein the video unit is acoding block or a video slice or a video picture or a video tile or avideo subpicture.

22. The method of any of claims 1-21, wherein the conversion comprisesgenerating the video from the bitstream or generating the bitstream fromthe video.

23. A method of storing a bitstream on a computer-readable medium,comprising generating a bitstream according to a method recited in anyone or more of claims 1-22 and storing the bitstream on thecomputer-readable medium.

24. A computer-readable medium having a bitstream of a video storedthereon, the bitstream, when processed by a processor of a videodecoder, causing the video decoder to generate the video, wherein thebitstream is generated according to a method recited in one or more ofclaims 1-22.

25. A video decoding apparatus comprising a processor configured toimplement a method recited in one or more of claims 1 to 22.

26. A video encoding apparatus comprising a processor configured toimplement a method recited in one or more of claims 1 to 22.

27. A computer program product having computer code stored thereon, thecode, when executed by a processor, causes the processor to implement amethod recited in any of claims 1 to 22.

28. A computer readable medium on which a bitstream complying to abitstream format that is generated according to any of claims 1 to 22.

29. A method, an apparatus, a bitstream generated according to adisclosed method or a system described in the present document.

The following documents are incorporated by reference in their entirety:

-   [1] Johannes Ballé, Valero Laparra, and Eero P Simoncelli,    “End-to-end optimization of nonlinear transform codes for perceptual    quality,” PCS IEEE (2016), 1-5.-   [2] Lucas Theis, Wenzhe Shi, Andrew Cunningham, and Ferenc Huszár,    “Lossy image compression with compressive autoencoders,” arXiv    preprint arXiv:1703.00395 (2017).-   [3] Jiahao Li, Bin Li, Jizheng Xu, Ruiqin Xiong, and Wen Gao, “Fully    Connected Network-Based Intra Prediction for Image Coding, “IEEE    Transactions on Image Processing” 27, 7 (2018), 3236-3247.-   [4] Yuanying Dai, Dong Liu, and Feng Wu, “A convolutional neural    network approach for post-processing in HEVC intra coding,” MMM.    Springer, 28-39.-   [5] Rui Song, Dong Liu, Houqiang Li, and Feng Wu, “Neural    network-based arithmetic coding of intra prediction modes in HEVC,”    VCIP IEEE (2017), 1-4.-   [6] J. Pfaff, P. Helle, D. Maniry, S. Kaltenstadler, W. Samek, H.    Schwarz, D. Marpe, and T. Wiegand, “Neural network based intra    prediction for video coding,” Applications of Digital Image    Processing XLI, Vol. 10752. International Society for Optics and    Photonics, 1075213 (2018).

The disclosed and other solutions, examples, embodiments, modules andthe functional operations described in this document can be implementedin digital electronic circuitry, or in computer software, firmware, orhardware, including the structures disclosed in this document and theirstructural equivalents, or in combinations of one or more of them. Thedisclosed and other embodiments can be implemented as one or morecomputer program products, i.e., one or more modules of computer programinstructions encoded on a computer readable medium for execution by, orto control the operation of, data processing apparatus. The computerreadable medium can be a machine-readable storage device, amachine-readable storage substrate, a memory device, a composition ofmatter effecting a machine-readable propagated signal, or a combinationof one or more them. The term “data processing apparatus” encompassesall apparatus, devices, and machines for processing data, including byway of example a programmable processor, a computer, or multipleprocessors or computers. The apparatus can include, in addition tohardware, code that creates an execution environment for the computerprogram in question, e.g., code that constitutes processor firmware, aprotocol stack, a database management system, an operating system, or acombination of one or more of them. A propagated signal is anartificially generated signal, e.g., a machine-generated electrical,optical, or electromagnetic signal, that is generated to encodeinformation for transmission to suitable receiver apparatus.

A computer program (also known as a program, software, softwareapplication, script, or code) can be written in any form of programminglanguage, including compiled or interpreted languages, and it can bedeployed in any form, including as a stand-alone program or as a module,component, subroutine, or other unit suitable for use in a computingenvironment. A computer program does not necessarily correspond to afile in a file system. A program can be stored in a portion of a filethat holds other programs or data (e.g., one or more scripts stored in amarkup language document), in a single file dedicated to the program inquestion, or in multiple coordinated files (e.g., files that store oneor more modules, sub programs, or portions of code). A computer programcan be deployed to be executed on one computer or on multiple computersthat are located at one site or distributed across multiple sites andinterconnected by a communication network.

The processes and logic flows described in this document can beperformed by one or more programmable processors executing one or morecomputer programs to perform functions by operating on input data andgenerating output. The processes and logic flows can also be performedby, and apparatus can also be implemented as, special purpose logiccircuitry, e.g., an FPGA (field programmable gate array) or an ASIC(application specific integrated circuit).

Processors suitable for the execution of a computer program include, byway of example, both general and special purpose microprocessors, andany one or more processors of any kind of digital computer. Generally, aprocessor will receive instructions and data from a read only memory ora random-access memory or both. The essential elements of a computer area processor for performing instructions and one or more memory devicesfor storing instructions and data. Generally, a computer will alsoinclude, or be operatively coupled to receive data from or transfer datato, or both, one or more mass storage devices for storing data, e.g.,magnetic, magneto optical disks, or optical disks. However, a computerneed not have such devices. Computer readable media suitable for storingcomputer program instructions and data include all forms of non-volatilememory, media and memory devices, including by way of examplesemiconductor memory devices, e.g., erasable programmable read-onlymemory (EPROM), electrically erasable programmable read-only memory(EEPROM), and flash memory devices; magnetic disks, e.g., internal harddisks or removable disks; magneto optical disks; and compact diskread-only memory (CD ROM) and digital versatile disc-read only memory(DVD-ROM) disks. The processor and the memory can be supplemented by, orincorporated in, special purpose logic circuitry.

While this patent document contains many specifics, these should not beconstrued as limitations on the scope of any subject matter or of whatmay be claimed, but rather as descriptions of features that may bespecific to particular embodiments of particular techniques. Certainfeatures that are described in this patent document in the context ofseparate embodiments can also be implemented in combination in a singleembodiment. Conversely, various features that are described in thecontext of a single embodiment can also be implemented in multipleembodiments separately or in any suitable subcombination. Moreover,although features may be described above as acting in certaincombinations and even initially claimed as such, one or more featuresfrom a claimed combination can in some cases be excised from thecombination, and the claimed combination may be directed to asubcombination or variation of a subcombination.

Similarly, while operations are depicted in the drawings in a particularorder, this should not be understood as requiring that such operationsbe performed in the particular order shown or in sequential order, orthat all illustrated operations be performed, to achieve desirableresults. Moreover, the separation of various system components in theembodiments described in this patent document should not be understoodas requiring such separation in all embodiments.

Only a few implementations and examples are described and otherimplementations, enhancements and variations can be made based on whatis described and illustrated in this patent document.

While this patent document contains many specifics, these should not beconstrued as limitations on the scope of any subject matter or of whatmay be claimed, but rather as descriptions of features that may bespecific to particular embodiments of particular techniques. Certainfeatures that are described in this patent document in the context ofseparate embodiments can also be implemented in combination in a singleembodiment. Conversely, various features that are described in thecontext of a single embodiment can also be implemented in multipleembodiments separately or in any suitable sub-combination. Moreover,although features may be described above as acting in certaincombinations and even initially claimed as such, one or more featuresfrom a claimed combination can in some cases be excised from thecombination, and the claimed combination may be directed to asub-combination or variation of a sub-combination.

Similarly, while operations are depicted in the drawings in a particularorder, this should not be understood as requiring that such operationsbe performed in the particular order shown or in sequential order, orthat all illustrated operations be performed, to achieve desirableresults. Moreover, the separation of various system components in theembodiments described in this patent document should not be understoodas requiring such separation in all embodiments.

Only a few implementations and examples are described and otherimplementations, enhancements and variations can be made based on whatis described and illustrated in this patent document.

What is claimed is:
 1. A method implemented by a video coding apparatus,comprising: applying an output of a neural network (NN) filter to anunfiltered sample of a video unit to generate a residual; applying ascaling function to the residual to generate a scaled residual; addinganother unfiltered sample to the scaled residual to generate a filteredsample; and converting between a video media file and a bitstream basedon the filtered sample that was generated.
 2. The method of claim 1,further comprising reconstructing the unfiltered sample prior togenerating the residual.
 3. The method of claim 1, wherein the filteredsample is generated according to Y=X+F(R), where X represents theunfiltered sample, R represents the residual determined based on theoutput of the NN filter, F represents the scaling function, and Yrepresents the filtered sample.
 4. The method of claim 1, wherein thefiltered sample is generated according to Y=X+F(R, X), where Xrepresents the unfiltered sample, R represents the residual determinedbased on the output of the NN filter, F represents the scaling function,and Y represents the filtered sample.
 5. The method of claim 1, whereinthe filtered sample is generated according to Y=X+F(R−X), where Xrepresents the unfiltered sample, R represents the residual determinedbased on the output of the NN filter, F represents the scaling function,and Y represents the filtered sample.
 6. The method of claim 1, whereinthe filtered sample is generated according to Y=Clip(X+F(R)), where Xrepresents the unfiltered sample, R represents the residual determinedbased on the output of the NN filter, F represents the scaling function,Clip represents a clipping function based on a bit depth of theunfiltered sample, and Y represents the filtered sample.
 7. The methodof claim 1, wherein the scaling function is based on a linear modelaccording to F(R)=α×R+β, where R represents the residual determinedbased on the output of the NN filter, F represents the scaling function,and α and β represent a pair of coefficient candidates (α, β).
 8. Themethod of claim 1, further comprising determining an inference blocksize to be used when the NN filter is applied to the unfiltered sample.9. The method of claim 8, further comprising selecting the inferenceblock size from a plurality of inference block size candidates, whereineach of the plurality of inference block size candidates is based on atleast one of a quantization parameter, a slice type, a picture type, apartition tree, and a color component.
 10. The method of claim 1,further comprising parsing the bitstream to obtain an indicator, whereinthe indicator indicates which inference block size is to be used whenthe NN filter is applied to the unfiltered sample.
 11. The method ofclaim 8, wherein the inference block size has a first value for a firstbit rate and a second value for a second bit rate, wherein the firstvalue is higher than the second value, and wherein the first bit rate islower than the second bit rate.
 12. The method of claim 8, wherein theinference block size has a first value for a first resolution and asecond value for a second resolution, wherein the first value is higherthan the second value, and wherein the first resolution is higher thanthe second resolution.
 13. The method of claim 1, wherein the NN filteris one of a plurality of NN filters whose outputs are applied to theunfiltered sample to generate the residual.
 14. The method of claim 13,wherein some of the plurality of NN filters use different inferenceblock sizes when the outputs are applied to the unfiltered sample. 15.The method of claim 13, wherein the outputs of the plurality of NNfilters are individually weighted and applied to the unfiltered sampleas a weighted sum.
 16. The method of claim 13, wherein a model and aweight corresponding to each of the plurality of NN filters is signaledin the bitstream.
 17. The method of claim 13, wherein a weightcorresponding to each of the plurality of NN filters is based on one ormore of a quantization parameter, a slice type, a picture type, a colorcomponent, a color format, and a temporal layer.
 18. The method of claim13, wherein a weight corresponding to each of the plurality of NNfilters is based on one or more of an NN filter model, an inferenceblock size, or a spatial location of the unfiltered sample.
 19. Anapparatus for coding video data comprising a processor and anon-transitory memory with instructions thereon, wherein theinstructions upon execution by the processor cause the processor to:apply an output of a neural network (NN) filter to an unfiltered sampleof a video unit to generate a residual; apply a scaling function to theresidual to generate a scaled residual; add another unfiltered sample tothe scaled residual to generate a filtered sample; and convert between avideo media file and a bitstream based on the filtered sample that wasgenerated.
 20. A non-transitory computer readable medium comprising acomputer program product for use by a coding apparatus, the computerprogram product comprising computer executable instructions stored onthe non-transitory computer readable medium that, when executed by oneor more processors, cause the coding apparatus to: apply an output of aneural network (NN) filter to an unfiltered sample of a video unit togenerate a residual; apply a scaling function to the residual togenerate a scaled residual; add another unfiltered sample to the scaledresidual to generate a filtered sample; and convert between a videomedia file and a bitstream based on the filtered sample that wasgenerated.